
<!doctype html>
<html lang="zh" class="no-js">
  <head>
    
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width,initial-scale=1">
      
      
      
      <link rel="icon" href="../img/favicon.ico">
      <meta name="generator" content="mkdocs-1.3.0, mkdocs-material-8.2.10">
    
    
      
        <title>功能介绍 - RepChain V2.0</title>
      
    
    
      <link rel="stylesheet" href="../assets/stylesheets/main.df45aa19.min.css">
      
        
        <link rel="stylesheet" href="../assets/stylesheets/palette.9647289d.min.css">
        
      
    
    
    
      
        
        
        <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
        <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,700,700i%7CRoboto+Mono:400,400i,700,700i&display=fallback">
        <style>:root{--md-text-font:"Roboto";--md-code-font:"Roboto Mono"}</style>
      
    
    
    <script>__md_scope=new URL("..",location),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
    
      

    
    
  </head>
  
  
    
    
      
    
    
    
    
    <body dir="ltr" data-md-color-scheme="default" data-md-color-primary="green" data-md-color-accent="">
  
    
    
      <script>var palette=__md_get("__palette");if(palette&&"object"==typeof palette.color)for(var key of Object.keys(palette.color))document.body.setAttribute("data-md-color-"+key,palette.color[key])</script>
    
    <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
    <input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
    <label class="md-overlay" for="__drawer"></label>
    <div data-md-component="skip">
      
        
        <a href="#_1" class="md-skip">
          跳转至
        </a>
      
    </div>
    <div data-md-component="announce">
      
    </div>
    
    
      

<header class="md-header" data-md-component="header">
  <nav class="md-header__inner md-grid" aria-label="页眉">
    <a href=".." title="RepChain V2.0" class="md-header__button md-logo" aria-label="RepChain V2.0" data-md-component="logo">
      
  <img src="../img/favicon.ico" alt="logo">

    </a>
    <label class="md-header__button md-icon" for="__drawer">
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2Z"/></svg>
    </label>
    <div class="md-header__title" data-md-component="header-title">
      <div class="md-header__ellipsis">
        <div class="md-header__topic">
          <span class="md-ellipsis">
            RepChain V2.0
          </span>
        </div>
        <div class="md-header__topic" data-md-component="header-topic">
          <span class="md-ellipsis">
            
              功能介绍
            
          </span>
        </div>
      </div>
    </div>
    
      <form class="md-header__option" data-md-component="palette">
        
          
          
          <input class="md-option" data-md-color-media="" data-md-color-scheme="default" data-md-color-primary="green" data-md-color-accent=""  aria-label="Switch to dark mode"  type="radio" name="__palette" id="__palette_1">
          
            <label class="md-header__button md-icon" title="Switch to dark mode" for="__palette_2" hidden>
              <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="m17.75 4.09-2.53 1.94.91 3.06-2.63-1.81-2.63 1.81.91-3.06-2.53-1.94L12.44 4l1.06-3 1.06 3 3.19.09m3.5 6.91-1.64 1.25.59 1.98-1.7-1.17-1.7 1.17.59-1.98L15.75 11l2.06-.05L18.5 9l.69 1.95 2.06.05m-2.28 4.95c.83-.08 1.72 1.1 1.19 1.85-.32.45-.66.87-1.08 1.27C15.17 23 8.84 23 4.94 19.07c-3.91-3.9-3.91-10.24 0-14.14.4-.4.82-.76 1.27-1.08.75-.53 1.93.36 1.85 1.19-.27 2.86.69 5.83 2.89 8.02a9.96 9.96 0 0 0 8.02 2.89m-1.64 2.02a12.08 12.08 0 0 1-7.8-3.47c-2.17-2.19-3.33-5-3.49-7.82-2.81 3.14-2.7 7.96.31 10.98 3.02 3.01 7.84 3.12 10.98.31Z"/></svg>
            </label>
          
        
          
          
          <input class="md-option" data-md-color-media="" data-md-color-scheme="slate" data-md-color-primary="red" data-md-color-accent=""  aria-label="Switch to light mode"  type="radio" name="__palette" id="__palette_2">
          
            <label class="md-header__button md-icon" title="Switch to light mode" for="__palette_1" hidden>
              <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 7a5 5 0 0 1 5 5 5 5 0 0 1-5 5 5 5 0 0 1-5-5 5 5 0 0 1 5-5m0 2a3 3 0 0 0-3 3 3 3 0 0 0 3 3 3 3 0 0 0 3-3 3 3 0 0 0-3-3m0-7 2.39 3.42C13.65 5.15 12.84 5 12 5c-.84 0-1.65.15-2.39.42L12 2M3.34 7l4.16-.35A7.2 7.2 0 0 0 5.94 8.5c-.44.74-.69 1.5-.83 2.29L3.34 7m.02 10 1.76-3.77a7.131 7.131 0 0 0 2.38 4.14L3.36 17M20.65 7l-1.77 3.79a7.023 7.023 0 0 0-2.38-4.15l4.15.36m-.01 10-4.14.36c.59-.51 1.12-1.14 1.54-1.86.42-.73.69-1.5.83-2.29L20.64 17M12 22l-2.41-3.44c.74.27 1.55.44 2.41.44.82 0 1.63-.17 2.37-.44L12 22Z"/></svg>
            </label>
          
        
      </form>
    
    
    
      <label class="md-header__button md-icon" for="__search">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5Z"/></svg>
      </label>
      <div class="md-search" data-md-component="search" role="dialog">
  <label class="md-search__overlay" for="__search"></label>
  <div class="md-search__inner" role="search">
    <form class="md-search__form" name="search">
      <input type="text" class="md-search__input" name="query" aria-label="搜索" placeholder="搜索" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" required>
      <label class="md-search__icon md-icon" for="__search">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5Z"/></svg>
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12Z"/></svg>
      </label>
      <nav class="md-search__options" aria-label="查找">
        
        <button type="reset" class="md-search__icon md-icon" aria-label="清空当前内容" tabindex="-1">
          <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41Z"/></svg>
        </button>
      </nav>
      
    </form>
    <div class="md-search__output">
      <div class="md-search__scrollwrap" data-md-scrollfix>
        <div class="md-search-result" data-md-component="search-result">
          <div class="md-search-result__meta">
            正在初始化搜索引擎
          </div>
          <ol class="md-search-result__list"></ol>
        </div>
      </div>
    </div>
  </div>
</div>
    
    
  </nav>
  
</header>
    
    <div class="md-container" data-md-component="container">
      
      
        
          
        
      
      <main class="md-main" data-md-component="main">
        <div class="md-main__inner md-grid">
          
            
              
              <div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
                <div class="md-sidebar__scrollwrap">
                  <div class="md-sidebar__inner">
                    


<nav class="md-nav md-nav--primary" aria-label="导航栏" data-md-level="0">
  <label class="md-nav__title" for="__drawer">
    <a href=".." title="RepChain V2.0" class="md-nav__button md-logo" aria-label="RepChain V2.0" data-md-component="logo">
      
  <img src="../img/favicon.ico" alt="logo">

    </a>
    RepChain V2.0
  </label>
  
  <ul class="md-nav__list" data-md-scrollfix>
    
      
      
      

  
  
  
    <li class="md-nav__item">
      <a href=".." class="md-nav__link">
        首页
      </a>
    </li>
  

    
      
      
      

  
  
    
  
  
    <li class="md-nav__item md-nav__item--active">
      
      <input class="md-nav__toggle md-toggle" data-md-toggle="toc" type="checkbox" id="__toc">
      
      
      
        <label class="md-nav__link md-nav__link--active" for="__toc">
          功能介绍
          <span class="md-nav__icon md-icon"></span>
        </label>
      
      <a href="./" class="md-nav__link md-nav__link--active">
        功能介绍
      </a>
      
        

<nav class="md-nav md-nav--secondary" aria-label="目录">
  
  
  
  
    <label class="md-nav__title" for="__toc">
      <span class="md-nav__icon md-icon"></span>
      目录
    </label>
    <ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
      
        <li class="md-nav__item">
  <a href="#_1" class="md-nav__link">
    多链协同
  </a>
  
    <nav class="md-nav" aria-label="多链协同">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#_2" class="md-nav__link">
    应用模式
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#_3" class="md-nav__link">
    术语
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#_4" class="md-nav__link">
    账户权限管理
  </a>
  
    <nav class="md-nav" aria-label="账户权限管理">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#_5" class="md-nav__link">
    账户
  </a>
  
    <nav class="md-nav" aria-label="账户">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#_6" class="md-nav__link">
    注册账户
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_7" class="md-nav__link">
    禁用/启用账户
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_8" class="md-nav__link">
    代码示例
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_9" class="md-nav__link">
    证书
  </a>
  
    <nav class="md-nav" aria-label="证书">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#_10" class="md-nav__link">
    注册证书
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_11" class="md-nav__link">
    禁用/启用证书
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_12" class="md-nav__link">
    代码示例
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_13" class="md-nav__link">
    操作
  </a>
  
    <nav class="md-nav" aria-label="操作">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#_14" class="md-nav__link">
    注册操作
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_15" class="md-nav__link">
    禁用/启用操作
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_16" class="md-nav__link">
    代码示例
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_17" class="md-nav__link">
    授权
  </a>
  
    <nav class="md-nav" aria-label="授权">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#_18" class="md-nav__link">
    让渡操作
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_19" class="md-nav__link">
    禁用/启用授权
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_20" class="md-nav__link">
    绑定授权到证书
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_21" class="md-nav__link">
    代码示例
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#sdk" class="md-nav__link">
    SDK使用
  </a>
  
    <nav class="md-nav" aria-label="SDK使用">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#rcjava-core" class="md-nav__link">
    RCJava-core
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#repchain" class="md-nav__link">
    RepChain启动方式
  </a>
  
    <nav class="md-nav" aria-label="RepChain启动方式">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#_22" class="md-nav__link">
    单机多节点
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_23" class="md-nav__link">
    分布式单机单节点
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_24" class="md-nav__link">
    节点管理服务
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#repchainmanagement" class="md-nav__link">
    RepChainManagement
  </a>
  
    <nav class="md-nav" aria-label="RepChainManagement">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#_25" class="md-nav__link">
    配置说明
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_26" class="md-nav__link">
    使用说明
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#_27" class="md-nav__link">
    动态管理组网节点
  </a>
  
    <nav class="md-nav" aria-label="动态管理组网节点">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#_28" class="md-nav__link">
    管理方案
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_29" class="md-nav__link">
    使用流程
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_30" class="md-nav__link">
    验证方式
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#_31" class="md-nav__link">
    动态管理共识列表
  </a>
  
    <nav class="md-nav" aria-label="动态管理共识列表">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#_32" class="md-nav__link">
    管理方案
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_33" class="md-nav__link">
    使用流程
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_34" class="md-nav__link">
    验证方式
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#qa" class="md-nav__link">
    Q&amp;A
  </a>
  
</li>
      
    </ul>
  
</nav>
      
    </li>
  

    
      
      
      

  
  
  
    <li class="md-nav__item">
      <a href="../deploy/" class="md-nav__link">
        安装部署
      </a>
    </li>
  

    
  </ul>
</nav>
                  </div>
                </div>
              </div>
            
            
              
              <div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
                <div class="md-sidebar__scrollwrap">
                  <div class="md-sidebar__inner">
                    

<nav class="md-nav md-nav--secondary" aria-label="目录">
  
  
  
  
    <label class="md-nav__title" for="__toc">
      <span class="md-nav__icon md-icon"></span>
      目录
    </label>
    <ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
      
        <li class="md-nav__item">
  <a href="#_1" class="md-nav__link">
    多链协同
  </a>
  
    <nav class="md-nav" aria-label="多链协同">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#_2" class="md-nav__link">
    应用模式
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#_3" class="md-nav__link">
    术语
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#_4" class="md-nav__link">
    账户权限管理
  </a>
  
    <nav class="md-nav" aria-label="账户权限管理">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#_5" class="md-nav__link">
    账户
  </a>
  
    <nav class="md-nav" aria-label="账户">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#_6" class="md-nav__link">
    注册账户
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_7" class="md-nav__link">
    禁用/启用账户
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_8" class="md-nav__link">
    代码示例
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_9" class="md-nav__link">
    证书
  </a>
  
    <nav class="md-nav" aria-label="证书">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#_10" class="md-nav__link">
    注册证书
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_11" class="md-nav__link">
    禁用/启用证书
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_12" class="md-nav__link">
    代码示例
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_13" class="md-nav__link">
    操作
  </a>
  
    <nav class="md-nav" aria-label="操作">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#_14" class="md-nav__link">
    注册操作
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_15" class="md-nav__link">
    禁用/启用操作
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_16" class="md-nav__link">
    代码示例
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_17" class="md-nav__link">
    授权
  </a>
  
    <nav class="md-nav" aria-label="授权">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#_18" class="md-nav__link">
    让渡操作
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_19" class="md-nav__link">
    禁用/启用授权
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_20" class="md-nav__link">
    绑定授权到证书
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_21" class="md-nav__link">
    代码示例
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#sdk" class="md-nav__link">
    SDK使用
  </a>
  
    <nav class="md-nav" aria-label="SDK使用">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#rcjava-core" class="md-nav__link">
    RCJava-core
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#repchain" class="md-nav__link">
    RepChain启动方式
  </a>
  
    <nav class="md-nav" aria-label="RepChain启动方式">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#_22" class="md-nav__link">
    单机多节点
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_23" class="md-nav__link">
    分布式单机单节点
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_24" class="md-nav__link">
    节点管理服务
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#repchainmanagement" class="md-nav__link">
    RepChainManagement
  </a>
  
    <nav class="md-nav" aria-label="RepChainManagement">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#_25" class="md-nav__link">
    配置说明
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_26" class="md-nav__link">
    使用说明
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#_27" class="md-nav__link">
    动态管理组网节点
  </a>
  
    <nav class="md-nav" aria-label="动态管理组网节点">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#_28" class="md-nav__link">
    管理方案
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_29" class="md-nav__link">
    使用流程
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_30" class="md-nav__link">
    验证方式
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#_31" class="md-nav__link">
    动态管理共识列表
  </a>
  
    <nav class="md-nav" aria-label="动态管理共识列表">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#_32" class="md-nav__link">
    管理方案
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_33" class="md-nav__link">
    使用流程
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#_34" class="md-nav__link">
    验证方式
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#qa" class="md-nav__link">
    Q&amp;A
  </a>
  
</li>
      
    </ul>
  
</nav>
                  </div>
                </div>
              </div>
            
          
          <div class="md-content" data-md-component="content">
            <article class="md-content__inner md-typeset">
              
                


  <h1>功能介绍</h1>

<h2 id="_1">多链协同</h2>
<h3 id="_2">应用模式</h3>
<ul>
<li>
<p>单链管理账户、证书以及操作权限，同时负责业务</p>
<p><img alt="auth-chain.png" src="../img/auth-chain.png" /></p>
<p>1.使用默认配置的levelDB</p>
<p>2.要构建创世块，运行<code>src/main/scala</code>目录下<code>rep.utils.CreateGenesisInfo</code>，生成的创世块文件在<code>json/identity-net/genesis.json</code>（身份链）</p>
<p>使用示例：<a href="https://gitee.com/BTAJL/RCJava-core/blob/master/src/test/java/com/rcjava/did">https://gitee.com/BTAJL/RCJava-core/blob/master/src/test/java/com/rcjava/did</a></p>
</li>
<li>
<p>身份链管理账户、证书以及操作权限，业务链只负责业务</p>
<p><img alt="auth-single" src="../img/auth-single.png" /></p>
<p>1.要配置为共享levelDB
2.要分别构建身份链和业务链的创世块，运行<code>src/main/scala</code>目录下<code>rep.utils.CreateGenesisInfo</code>（身份链）和<code>rep.utils.CreateGenesisInfo4NoTransaction</code>（业务链），生成的创世块文件分别在<code>json/identity-net/genesis.json</code>（身份链）和<code>json/credence-net/genesis.json</code>（业务链）</p>
<p>使用示例：<a href="https://gitee.com/BTAJL/RCJava-core/blob/master/src/test/java/com/rcjava/multi_chain/MultiChainTest.java">https://gitee.com/BTAJL/RCJava-core/blob/master/src/test/java/com/rcjava/multi_chain/MultiChainTest.java</a></p>
</li>
<li>
<p>身份链管理账户、证书，业务链管理操作权限并负责业务</p>
<p><img alt="auth-seperate" src="../img/auth-seperate.png" /></p>
<p>1.要配置为共享levelDB
2.要分别构建身份链和业务链的创世块，运行<code>src/main/scala</code>目录下<code>rep.utils.identity.CreateIdentityGenesisInfo</code> （身份链） 和<code>rep.utils.credence.CreateCredenceGenesisInfo</code>（业务链），生成的创世块文件分别在<code>json/identity-net/genesis.json</code>（身份链）和<code>json/credence-net/genesis.json</code>（业务链）</p>
<p>使用示例：<a href="https://gitee.com/BTAJL/RCJava-core/blob/master/src/test/java/com/rcjava/multi_chain/MultiChainSeparateTest.java">https://gitee.com/BTAJL/RCJava-core/blob/master/src/test/java/com/rcjava/multi_chain/MultiChainSeparateTest.java</a></p>
</li>
</ul>
<p>配置文件如下所示，<code>identity-net</code>为身份链标识，<code>credence-net</code>为业务链标识，node1参与身份链组网，node6参与业务链组网，node1和node6的LevelDB配置为同一个存储目录，node6的<code>basic_chain_id</code>为身份链：</p>
<blockquote>
<div class="highlight"><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="l l-Scalar l-Scalar-Plain">// 身份链参考conf/121000005l35120456.node1/system.conf</span><span class="w"></span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a><span class="l l-Scalar l-Scalar-Plain">system {</span><span class="w"></span>
<a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a><span class="l l-Scalar l-Scalar-Plain">chain_network_id = &quot;identity-net&quot;</span><span class="w"> </span><span class="c1">#组网id，组网id的命名不能包含&quot;_&quot;这样的字符</span><span class="w"></span>
<a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a><span class="l l-Scalar l-Scalar-Plain">basic_chain_id = &quot;identity-net&quot;</span><span class="w">   </span><span class="c1">#账户、证书身份全部交由自己管理</span><span class="w"></span>
<a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a><span class="err">}</span><span class="w"></span>
<a id="__codelineno-0-6" name="__codelineno-0-6" href="#__codelineno-0-6"></a><span class="l l-Scalar l-Scalar-Plain">storage {</span><span class="w"></span>
<a id="__codelineno-0-7" name="__codelineno-0-7" href="#__codelineno-0-7"></a><span class="l l-Scalar l-Scalar-Plain">db_type = &quot;LevelDB&quot;</span><span class="w"> </span><span class="c1">#支持数据库的类型：LevelDB、RocksDB</span><span class="w"></span>
<a id="__codelineno-0-8" name="__codelineno-0-8" href="#__codelineno-0-8"></a><span class="l l-Scalar l-Scalar-Plain">db_path = &quot;./repchaindata/data/leveldbdata&quot;</span><span class="w"></span>
<a id="__codelineno-0-9" name="__codelineno-0-9" href="#__codelineno-0-9"></a><span class="l l-Scalar l-Scalar-Plain">db_name = &quot;215159697776981712.node1&quot;</span><span class="w"></span>
<a id="__codelineno-0-10" name="__codelineno-0-10" href="#__codelineno-0-10"></a><span class="l l-Scalar l-Scalar-Plain">db_cache_size=48</span><span class="w"> </span><span class="c1">#数据库读写缓存，单位为M</span><span class="w"></span>
<a id="__codelineno-0-11" name="__codelineno-0-11" href="#__codelineno-0-11"></a>
<a id="__codelineno-0-12" name="__codelineno-0-12" href="#__codelineno-0-12"></a><span class="l l-Scalar l-Scalar-Plain">block_file_type = &quot;localFileSystem&quot;</span><span class="w"></span>
<a id="__codelineno-0-13" name="__codelineno-0-13" href="#__codelineno-0-13"></a><span class="l l-Scalar l-Scalar-Plain">block_file_path = &quot;./repchaindata/data/blockdata&quot;</span><span class="w"></span>
<a id="__codelineno-0-14" name="__codelineno-0-14" href="#__codelineno-0-14"></a><span class="l l-Scalar l-Scalar-Plain">block_file_name = &quot;215159697776981712.node1&quot;</span><span class="w"></span>
<a id="__codelineno-0-15" name="__codelineno-0-15" href="#__codelineno-0-15"></a><span class="l l-Scalar l-Scalar-Plain">file_max_length = 100</span><span class="w"> </span><span class="c1">#单位为M</span><span class="w"></span>
<a id="__codelineno-0-16" name="__codelineno-0-16" href="#__codelineno-0-16"></a><span class="err">}</span><span class="w"></span>
</code></pre></div>
<div class="highlight"><pre><span></span><code><a id="__codelineno-1-1" name="__codelineno-1-1" href="#__codelineno-1-1"></a><span class="l l-Scalar l-Scalar-Plain">// 业务链参考conf/330597659476689954.node6/system.conf</span><span class="w"></span>
<a id="__codelineno-1-2" name="__codelineno-1-2" href="#__codelineno-1-2"></a><span class="l l-Scalar l-Scalar-Plain">system {</span><span class="w"></span>
<a id="__codelineno-1-3" name="__codelineno-1-3" href="#__codelineno-1-3"></a><span class="l l-Scalar l-Scalar-Plain">chain_network_id = &quot;credence-net&quot;</span><span class="w"> </span><span class="c1">#组网id，组网id的命名不能包含&quot;_&quot;这样的字符</span><span class="w"></span>
<a id="__codelineno-1-4" name="__codelineno-1-4" href="#__codelineno-1-4"></a><span class="l l-Scalar l-Scalar-Plain">basic_chain_id = &quot;identity-net&quot;</span><span class="w">   </span><span class="c1">#账户、证书交由identity-net管理</span><span class="w"></span>
<a id="__codelineno-1-5" name="__codelineno-1-5" href="#__codelineno-1-5"></a><span class="err">}</span><span class="w"></span>
<a id="__codelineno-1-6" name="__codelineno-1-6" href="#__codelineno-1-6"></a><span class="l l-Scalar l-Scalar-Plain">storage {</span><span class="w"></span>
<a id="__codelineno-1-7" name="__codelineno-1-7" href="#__codelineno-1-7"></a><span class="l l-Scalar l-Scalar-Plain">db_type = &quot;LevelDB&quot;</span><span class="w"> </span><span class="c1">#支持数据库的类型：LevelDB、RocksDB</span><span class="w"></span>
<a id="__codelineno-1-8" name="__codelineno-1-8" href="#__codelineno-1-8"></a><span class="l l-Scalar l-Scalar-Plain">db_path = &quot;./repchaindata/data/leveldbdata&quot;</span><span class="w"></span>
<a id="__codelineno-1-9" name="__codelineno-1-9" href="#__codelineno-1-9"></a><span class="l l-Scalar l-Scalar-Plain">db_name = &quot;215159697776981712.node1&quot;</span><span class="w"></span>
<a id="__codelineno-1-10" name="__codelineno-1-10" href="#__codelineno-1-10"></a><span class="l l-Scalar l-Scalar-Plain">db_cache_size=48</span><span class="w"> </span><span class="c1">#数据库读写缓存，单位为M</span><span class="w"></span>
<a id="__codelineno-1-11" name="__codelineno-1-11" href="#__codelineno-1-11"></a>
<a id="__codelineno-1-12" name="__codelineno-1-12" href="#__codelineno-1-12"></a><span class="l l-Scalar l-Scalar-Plain">block_file_type = &quot;localFileSystem&quot;</span><span class="w"></span>
<a id="__codelineno-1-13" name="__codelineno-1-13" href="#__codelineno-1-13"></a><span class="l l-Scalar l-Scalar-Plain">block_file_path = &quot;./repchaindata/data/blockdata&quot;</span><span class="w"></span>
<a id="__codelineno-1-14" name="__codelineno-1-14" href="#__codelineno-1-14"></a><span class="l l-Scalar l-Scalar-Plain">block_file_name = &quot;215159697776981712.node1&quot;</span><span class="w"></span>
<a id="__codelineno-1-15" name="__codelineno-1-15" href="#__codelineno-1-15"></a><span class="l l-Scalar l-Scalar-Plain">file_max_length = 100</span><span class="w"> </span><span class="c1">#单位为M</span><span class="w"></span>
<a id="__codelineno-1-16" name="__codelineno-1-16" href="#__codelineno-1-16"></a><span class="err">}</span><span class="w"></span>
</code></pre></div>
</blockquote>
<h2 id="_3">术语</h2>
<ul>
<li>账户</li>
</ul>
<p>用户要使用区块链，必须先在RepChain上注册一个账户。</p>
<ul>
<li>证书</li>
</ul>
<p>被RepChain用于验证用户提交的签名交易。一个账户下可以注册多个数字证书，账户与证书为一对多的关系</p>
<ul>
<li>操作</li>
</ul>
<p>只要是涉及到签名交易，都具体到某一个<strong>操作</strong>上，操作分<strong><u>公开与非公开</u></strong>，如果操作被注册为<u>”公开“，不需要授权给其他用户，其他用户也可以调用</u>，如果被注册为”非公开“，则其他用户需要得到授权才能调用。一个账户下，可以注册多个操作，账户与操作为一对多的关系</p>
<p><strong>注：结合交易的三种类型（部署合约、修改合约状态和调用合约）来理解</strong></p>
<ul>
<li>授权</li>
</ul>
<p>将用户<strong>自有的操作</strong>或<strong>别人授权给自己且可以再次让渡</strong>的操作，授权给别人。一个账户下可以有多个被授权的操作，账户与被授权的操作为一对多的关系</p>
<h2 id="_4">账户权限管理</h2>
<p>RepChain-v2.0.0通过<strong>权限管理合约</strong>（默认内置的系统合约，合约名：<code>RdidOperateAuthorizeTPL</code>，版本号：<code>1</code>）来管理用户身份（账户、权限等），目前合约里定义的所有方法如下表所示：</p>
<blockquote>
<p>是否公开："否"表示用户调用该方法需要被授权，"是"表示用户调用该方法无需被授权</p>
</blockquote>
<table>
<thead>
<tr>
<th align="left">合约方法名</th>
<th align="left">用途描述</th>
<th align="center">是否公开</th>
<th>方法形参</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left"><code>signUpSigner</code></td>
<td align="left">注册账户</td>
<td align="center">否</td>
<td>rep.proto.rc2.Signer</td>
</tr>
<tr>
<td align="left"><code>updateSigner</code></td>
<td align="left">更新账户</td>
<td align="center">否</td>
<td>rep.proto.rc2.Signer</td>
</tr>
<tr>
<td align="left"><code>updateSignerStatus</code></td>
<td align="left">修改账户状态，禁用/启用</td>
<td align="center">否</td>
<td>SignerStatus(creditCode: String, state: Boolean)</td>
</tr>
<tr>
<td align="left"><code>signUpCertificate</code></td>
<td align="left">注册普通证书</td>
<td align="center">是</td>
<td>rep.proto.rc2.Certificate</td>
</tr>
<tr>
<td align="left"><code>updateCertificateStatus</code></td>
<td align="left">修改普通证书状态</td>
<td align="center">是</td>
<td>CertStatus(creditCode: String, certName: String, state: Boolean)</td>
</tr>
<tr>
<td align="left"><code>signUpAllTypeCertificate</code></td>
<td align="left">注册身份/普通证书</td>
<td align="center">否</td>
<td>rep.proto.rc2.Certificate</td>
</tr>
<tr>
<td align="left"><code>updateAllTypeCertificateStatus</code></td>
<td align="left">修改身份/普通证书状态</td>
<td align="center">否</td>
<td>CertStatus(creditCode: String, certName: String, state: Boolean)</td>
</tr>
<tr>
<td align="left"><code>signUpOperate</code></td>
<td align="left">为用户自己注册操作</td>
<td align="center">是</td>
<td>rep.proto.rc2.Operate</td>
</tr>
<tr>
<td align="left"><code>updateOperateStatus</code></td>
<td align="left">修改操作状态，禁用/启用</td>
<td align="center">是</td>
<td>OperateStatus(opId: String, state: Boolean)</td>
</tr>
<tr>
<td align="left"><code>grantOperate</code></td>
<td align="left">授权（让渡权限）给其他用户</td>
<td align="center">是</td>
<td>List[AuthorizeString]]</td>
</tr>
<tr>
<td align="left"><code>updateGrantOperateStatus</code></td>
<td align="left">更新授权状态，禁用/启用</td>
<td align="center">是</td>
<td>AuthorizeStatus(authId: String, state: Boolean)</td>
</tr>
<tr>
<td align="left"><code>bindCertToAuthorize</code></td>
<td align="left">将权限绑定到用户具体的某个证书</td>
<td align="center">是</td>
<td>rep.proto.rc2.BindCertToAuthorize</td>
</tr>
</tbody>
</table>
<ul>
<li>上面列举的所有方法（操作）都已经在通过创世块注册到了super_admin（<code>"identity-net:951002007l78123233"</code>）的账户下</li>
<li>super_admin可以将非公开的方法授权给其他注册用户（授权时，可以设置为允许/禁止该用户再次让渡给其他用户）</li>
<li>部分形参结构体在RepChain项目的<code>src/main/protobuf/rc2.proto</code>里定义</li>
</ul>
<h3 id="_5">账户</h3>
<p>账户作为用户在链上的身份权限的载体，主要组成部分如下图所示，账户ID是唯一标识，一个账户下可包含多个证书、多个操作、多个被授权的操作。</p>
<p><img alt="signer" src="../img/signer.png" /></p>
<h4 id="_6">注册账户</h4>
<p>合约方法：<code>signUpSigner</code>，非公开，需要授权，因此只要有调用<code>"signUpSigner"</code>方法的权限即可为新用户注册账户</p>
<ul>
<li>账户ID命名规范</li>
</ul>
<blockquote>
<p><code>NetWorkID:UUID</code>，如：<code>"identity-net:121000005l35120456"</code></p>
</blockquote>
<ul>
<li>注册流程</li>
</ul>
<blockquote>
<p>举例说明：现有用户A、B，用户A想为用户B注册账户</p>
<p>分析：首先用户A要取得可以调用<code>signUpSigner</code>的权限</p>
<p>方案之一：step1：superAdmin（或具有且可继续让渡该权限的其他用户）要先授权用户A调用<code>signUpSigner</code>的权限；step2：用户A调用<code>signUpSigner</code>为用户B注册账户</p>
</blockquote>
<p><img alt="signUpSigner" src="../img/signUpSigner.png" /></p>
<p>下面以使用<code>identity-net:951002007l78123233</code>（superAdmin）直接构造签名交易来调用权限管理合约为新用户注册账户（<code>"identity-net:usr-0"</code>）为例（基于RCJava-core）</p>
<ul>
<li>step1：用户usr-0自己生成密钥对以及证书<code>usr-0_0.cer</code>（自签名或CA签发）</li>
<li>step2：用户usr-0将step1生成的证书<code>usr-0_0.cer</code>交给具有注册账户权限的用户（如super_admin）</li>
<li>step3：super_admin调用权限管理合约为用户usr-0注册账户<code>identity-net:usr-0</code></li>
</ul>
<div class="highlight"><pre><span></span><code><a id="__codelineno-2-1" name="__codelineno-2-1" href="#__codelineno-2-1"></a><span class="n">TranPostClient</span><span class="w"> </span><span class="n">postClient</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">new</span><span class="w"> </span><span class="n">TranPostClient</span><span class="p">(</span><span class="s">&quot;localhost:9081&quot;</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-2-2" name="__codelineno-2-2" href="#__codelineno-2-2"></a><span class="n">ChainInfoClient</span><span class="w"> </span><span class="n">infoClient</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">new</span><span class="w"> </span><span class="n">ChainInfoClient</span><span class="p">(</span><span class="s">&quot;localhost:9081&quot;</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-2-3" name="__codelineno-2-3" href="#__codelineno-2-3"></a>
<a id="__codelineno-2-4" name="__codelineno-2-4" href="#__codelineno-2-4"></a><span class="c1">// 账户权限管理合约</span><span class="w"></span>
<a id="__codelineno-2-5" name="__codelineno-2-5" href="#__codelineno-2-5"></a><span class="n">ChaincodeId</span><span class="w"> </span><span class="n">didChaincodeId</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">ChaincodeId</span><span class="p">.</span><span class="na">newBuilder</span><span class="p">().</span><span class="na">setChaincodeName</span><span class="p">(</span><span class="s">&quot;RdidOperateAuthorizeTPL&quot;</span><span class="p">).</span><span class="na">setVersion</span><span class="p">(</span><span class="mi">1</span><span class="p">).</span><span class="na">build</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-2-6" name="__codelineno-2-6" href="#__codelineno-2-6"></a><span class="c1">// 构造管理员的私钥</span><span class="w"></span>
<a id="__codelineno-2-7" name="__codelineno-2-7" href="#__codelineno-2-7"></a><span class="n">PrivateKey</span><span class="w"> </span><span class="n">super_pri</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">CertUtil</span><span class="p">.</span><span class="na">genX509CertPrivateKey</span><span class="p">(</span><span class="k">new</span><span class="w"> </span><span class="n">File</span><span class="p">(</span><span class="s">&quot;jks/identity-net/951002007l78123233.super_admin.jks&quot;</span><span class="p">),</span><span class="w"></span>
<a id="__codelineno-2-8" name="__codelineno-2-8" href="#__codelineno-2-8"></a><span class="w">                </span><span class="s">&quot;super_admin&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;951002007l78123233.super_admin&quot;</span><span class="p">).</span><span class="na">getPrivateKey</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-2-9" name="__codelineno-2-9" href="#__codelineno-2-9"></a><span class="n">TranCreator</span><span class="w"> </span><span class="n">superCreator</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">TranCreator</span><span class="p">.</span><span class="na">newBuilder</span><span class="p">().</span><span class="na">setPrivateKey</span><span class="p">(</span><span class="n">super_pri</span><span class="p">).</span><span class="na">setSignAlgorithm</span><span class="p">(</span><span class="s">&quot;SHA256withECDSA&quot;</span><span class="p">).</span><span class="na">build</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-2-10" name="__codelineno-2-10" href="#__codelineno-2-10"></a><span class="n">CertId</span><span class="w"> </span><span class="n">superCertId</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">CertId</span><span class="p">.</span><span class="na">newBuilder</span><span class="p">().</span><span class="na">setCreditCode</span><span class="p">(</span><span class="s">&quot;identity-net:951002007l78123233&quot;</span><span class="p">).</span><span class="na">setCertName</span><span class="p">(</span><span class="s">&quot;super_admin&quot;</span><span class="p">).</span><span class="na">build</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-2-11" name="__codelineno-2-11" href="#__codelineno-2-11"></a>
<a id="__codelineno-2-12" name="__codelineno-2-12" href="#__codelineno-2-12"></a><span class="c1">// 证书pem字符串</span><span class="w"></span>
<a id="__codelineno-2-13" name="__codelineno-2-13" href="#__codelineno-2-13"></a><span class="n">String</span><span class="w"> </span><span class="n">certPem</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">new</span><span class="w"> </span><span class="n">String</span><span class="p">(</span><span class="n">Files</span><span class="p">.</span><span class="na">readAllBytes</span><span class="p">(</span><span class="k">new</span><span class="w"> </span><span class="n">File</span><span class="p">(</span><span class="s">&quot;jks/test/did/usr-0_0.cer&quot;</span><span class="p">).</span><span class="na">toPath</span><span class="p">()));</span><span class="w"></span>
<a id="__codelineno-2-14" name="__codelineno-2-14" href="#__codelineno-2-14"></a><span class="n">Peer</span><span class="p">.</span><span class="na">Certificate</span><span class="w"> </span><span class="n">cert_proto</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Peer</span><span class="p">.</span><span class="na">Certificate</span><span class="p">.</span><span class="na">newBuilder</span><span class="p">()</span><span class="w"></span>
<a id="__codelineno-2-15" name="__codelineno-2-15" href="#__codelineno-2-15"></a><span class="w">        </span><span class="c1">// 新用户usr-0的证书&lt;Pem字符串&gt;</span><span class="w"></span>
<a id="__codelineno-2-16" name="__codelineno-2-16" href="#__codelineno-2-16"></a><span class="w">        </span><span class="p">.</span><span class="na">setCertificate</span><span class="p">(</span><span class="n">certPem</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-2-17" name="__codelineno-2-17" href="#__codelineno-2-17"></a><span class="w">        </span><span class="p">.</span><span class="na">setAlgType</span><span class="p">(</span><span class="s">&quot;sha256withecdsa&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-2-18" name="__codelineno-2-18" href="#__codelineno-2-18"></a><span class="w">        </span><span class="p">.</span><span class="na">setCertValid</span><span class="p">(</span><span class="kc">true</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-2-19" name="__codelineno-2-19" href="#__codelineno-2-19"></a><span class="w">        </span><span class="p">.</span><span class="na">setCertType</span><span class="p">(</span><span class="n">Peer</span><span class="p">.</span><span class="na">Certificate</span><span class="p">.</span><span class="na">CertType</span><span class="p">.</span><span class="na">CERT_AUTHENTICATION</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-2-20" name="__codelineno-2-20" href="#__codelineno-2-20"></a><span class="w">        </span><span class="c1">// 设置CertId，&lt;账户ID&gt;和&lt;证书别名&gt;</span><span class="w"></span>
<a id="__codelineno-2-21" name="__codelineno-2-21" href="#__codelineno-2-21"></a><span class="w">        </span><span class="p">.</span><span class="na">setId</span><span class="p">(</span><span class="n">Peer</span><span class="p">.</span><span class="na">CertId</span><span class="p">.</span><span class="na">newBuilder</span><span class="p">().</span><span class="na">setCreditCode</span><span class="p">(</span><span class="s">&quot;identity-net:usr-0&quot;</span><span class="p">).</span><span class="na">setCertName</span><span class="p">(</span><span class="s">&quot;0&quot;</span><span class="p">).</span><span class="na">build</span><span class="p">())</span><span class="w"></span>
<a id="__codelineno-2-22" name="__codelineno-2-22" href="#__codelineno-2-22"></a><span class="w">        </span><span class="p">.</span><span class="na">setCertHash</span><span class="p">(</span><span class="n">DigestUtils</span><span class="p">.</span><span class="na">sha256Hex</span><span class="p">(</span><span class="n">certPem</span><span class="p">.</span><span class="na">replaceAll</span><span class="p">(</span><span class="s">&quot;\r\n|\r|\n|\\s&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;&quot;</span><span class="p">)))</span><span class="w"></span>
<a id="__codelineno-2-23" name="__codelineno-2-23" href="#__codelineno-2-23"></a><span class="w">        </span><span class="p">.</span><span class="na">build</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-2-24" name="__codelineno-2-24" href="#__codelineno-2-24"></a>
<a id="__codelineno-2-25" name="__codelineno-2-25" href="#__codelineno-2-25"></a><span class="n">Peer</span><span class="p">.</span><span class="na">Signer</span><span class="w"> </span><span class="n">usr0_signer</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Peer</span><span class="p">.</span><span class="na">Signer</span><span class="p">.</span><span class="na">newBuilder</span><span class="p">()</span><span class="w"></span>
<a id="__codelineno-2-26" name="__codelineno-2-26" href="#__codelineno-2-26"></a><span class="w">        </span><span class="p">.</span><span class="na">setName</span><span class="p">(</span><span class="s">&quot;usr-0&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-2-27" name="__codelineno-2-27" href="#__codelineno-2-27"></a><span class="w">        </span><span class="c1">// 用户usr-0的账户ID</span><span class="w"></span>
<a id="__codelineno-2-28" name="__codelineno-2-28" href="#__codelineno-2-28"></a><span class="w">        </span><span class="p">.</span><span class="na">setCreditCode</span><span class="p">(</span><span class="s">&quot;identity-net:usr-0&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-2-29" name="__codelineno-2-29" href="#__codelineno-2-29"></a><span class="w">        </span><span class="p">.</span><span class="na">setMobile</span><span class="p">(</span><span class="s">&quot;18888888888&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-2-30" name="__codelineno-2-30" href="#__codelineno-2-30"></a><span class="w">        </span><span class="c1">// 注册账户时，要附带一个数字证书（身份证书）</span><span class="w"></span>
<a id="__codelineno-2-31" name="__codelineno-2-31" href="#__codelineno-2-31"></a><span class="w">        </span><span class="p">.</span><span class="na">addAllAuthenticationCerts</span><span class="p">(</span><span class="n">Collections</span><span class="p">.</span><span class="na">singletonList</span><span class="p">(</span><span class="n">cert_proto</span><span class="p">))</span><span class="w"></span>
<a id="__codelineno-2-32" name="__codelineno-2-32" href="#__codelineno-2-32"></a><span class="w">        </span><span class="p">.</span><span class="na">setSignerValid</span><span class="p">(</span><span class="kc">true</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-2-33" name="__codelineno-2-33" href="#__codelineno-2-33"></a><span class="w">        </span><span class="p">.</span><span class="na">build</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-2-34" name="__codelineno-2-34" href="#__codelineno-2-34"></a>
<a id="__codelineno-2-35" name="__codelineno-2-35" href="#__codelineno-2-35"></a><span class="c1">// super_admin向身份链提交交易，注册用户，以便在业务链使用</span><span class="w"></span>
<a id="__codelineno-2-36" name="__codelineno-2-36" href="#__codelineno-2-36"></a><span class="n">String</span><span class="w"> </span><span class="n">tranId</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">UUID</span><span class="p">.</span><span class="na">randomUUID</span><span class="p">().</span><span class="na">toString</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-2-37" name="__codelineno-2-37" href="#__codelineno-2-37"></a><span class="c1">// 构造签名交易</span><span class="w"></span>
<a id="__codelineno-2-38" name="__codelineno-2-38" href="#__codelineno-2-38"></a><span class="n">Peer</span><span class="p">.</span><span class="na">Transaction</span><span class="w"> </span><span class="n">tran</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">superCreator</span><span class="p">.</span><span class="na">createInvokeTran</span><span class="p">(</span><span class="n">tranId</span><span class="p">,</span><span class="w"> </span><span class="n">superCertId</span><span class="p">,</span><span class="w"> </span><span class="n">didChaincodeId</span><span class="p">,</span><span class="w"> </span><span class="n">signUpSigner</span><span class="p">,</span><span class="w"> </span><span class="n">JsonFormat</span><span class="p">.</span><span class="na">printer</span><span class="p">().</span><span class="na">print</span><span class="p">(</span><span class="n">usr0_signer</span><span class="p">),</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;&quot;</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-2-39" name="__codelineno-2-39" href="#__codelineno-2-39"></a><span class="c1">// 提交交易</span><span class="w"></span>
<a id="__codelineno-2-40" name="__codelineno-2-40" href="#__codelineno-2-40"></a><span class="n">postClient</span><span class="p">.</span><span class="na">postSignedTran</span><span class="p">(</span><span class="n">tran</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-2-41" name="__codelineno-2-41" href="#__codelineno-2-41"></a><span class="n">TimeUnit</span><span class="p">.</span><span class="na">SECONDS</span><span class="p">.</span><span class="na">sleep</span><span class="p">(</span><span class="mi">5</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-2-42" name="__codelineno-2-42" href="#__codelineno-2-42"></a><span class="c1">// 查询交易上链执行结果</span><span class="w"></span>
<a id="__codelineno-2-43" name="__codelineno-2-43" href="#__codelineno-2-43"></a><span class="n">Peer</span><span class="p">.</span><span class="na">TransactionResult</span><span class="w"> </span><span class="n">tranResult</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">infoClient</span><span class="p">.</span><span class="na">getTranResultByTranId</span><span class="p">(</span><span class="n">tranId</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-2-44" name="__codelineno-2-44" href="#__codelineno-2-44"></a><span class="n">Assertions</span><span class="p">.</span><span class="na">assertEquals</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="n">tranResult</span><span class="p">.</span><span class="na">getErr</span><span class="p">().</span><span class="na">getCode</span><span class="p">(),</span><span class="w"> </span><span class="s">&quot;没有错误，注册成功&quot;</span><span class="p">);</span><span class="w"></span>
</code></pre></div>
<h4 id="_7">禁用/启用账户</h4>
<p>如果用户不再使用RepChain，或者由于某些原因需要禁用账户，可修改用户的账户状态，只要有调用<code>"updateSignerStatus"</code>的权限即可修改用户的账户状态，可执行禁用或启用</p>
<p>合约方法：<code>updateSignerStatus</code>，非公开，需要授权，被授权的用户才可调用</p>
<blockquote>
<p>举例说明：现有用户A、B，用户A想禁用用户B的账户</p>
<p>分析：首先用户A要取得可以调用<code>updateSignerStatus</code>的权限</p>
<p>方案之一：step1：superAmdin（或具有且可继续让渡该权限的其他用户）要先授权用户A调用<code>updateSignerStatus</code>的权限；step2：用户A调用<code>updateSignerStatus</code>为禁用/启用用户B的账户</p>
</blockquote>
<p><img alt="updateSignerStatus" src="../img/updateSignerStatus.png" /></p>
<h4 id="_8">代码示例</h4>
<p>测试用例：<a href="https://gitee.com/BTAJL/RCJava-core/blob/master/src/test/java/com/rcjava/did/SignerOperationTest.java">https://gitee.com/BTAJL/RCJava-core/blob/master/src/test/java/com/rcjava/did/SignerOperationTest.java</a></p>
<h3 id="_9">证书</h3>
<p>证书分为身份证书和普通证书，身份证书相对普通证书比较重要，因为身份证书对应的密钥对构造的签名交易，可以为本账户注册普通证书或修改普通证书的状态（有效性）</p>
<p><img alt="cert" src="../img/cert.png" /></p>
<h4 id="_10">注册证书</h4>
<ul>
<li>注册普通证书</li>
</ul>
<blockquote>
<p>用户账户注册成功后，即可使用身份证书对应的密钥对构造签名交易，自行调用系统合约<code>RdidOperateAuthorizeTPL</code>中的<code>signUpCertificate</code>方法来为<strong>自己</strong>注册普通证书</p>
</blockquote>
<p>合约方法：<code>signUpCertificate</code>，公开，无需授权，任何注册用户均可调用</p>
<blockquote>
<p>举例说明：现有用户A，用户A想为用户A自己注册普通证书</p>
<p>用户A调用<code>signUpCertificate</code>即可为自己注册证书</p>
</blockquote>
<p><img alt="signUpCertificate" src="../img/signUpCertificate.png" /></p>
<ul>
<li>注册身份/普通证书</li>
</ul>
<blockquote>
<ol>
<li>注册账户时，会附带注册一个身份证书</li>
<li>除 1 之外，可在其他有需要的时候，通过调用系统合约<code>RdidOperateAuthorizeTPL</code>中的<code>signUpAllTypeCertificate</code>方法为一个有效账户（<strong>自己或其他</strong>）注册身份/普通证书</li>
</ol>
</blockquote>
<p>合约方法：<code>signUpAllTypeCertificate</code>，非公开，需要授权，被授权的用户才可调用</p>
<blockquote>
<p>举例说明：现有用户A、B，用户A想为用户A或B注册身份/普通证书</p>
<p>分析：首先用户A要取得可以调用<code>signUpAllTypeCertificate</code>的权限</p>
<p>方案之一：step1：superAdmin（或具有且可继续让渡该权限的其他用户）要先授权用户A调用<code>signUpAllTypeCertificate</code>的权限；step2：用户A调用<code>signUpAllTypeCertificate</code>为用户A/B注册身份/普通证书</p>
</blockquote>
<p><img alt="signUpAllTypeCertificate" src="../img/signUpAllTypeCertificate.png" /></p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-3-1" name="__codelineno-3-1" href="#__codelineno-3-1"></a><span class="c1">// 授权，super授权给usr0, 注册任意证书的方法</span><span class="w"></span>
<a id="__codelineno-3-2" name="__codelineno-3-2" href="#__codelineno-3-2"></a><span class="kt">long</span><span class="w"> </span><span class="n">millis</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">System</span><span class="p">.</span><span class="na">currentTimeMillis</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-3-3" name="__codelineno-3-3" href="#__codelineno-3-3"></a><span class="n">Peer</span><span class="p">.</span><span class="na">Authorize</span><span class="w"> </span><span class="n">authorize</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Peer</span><span class="p">.</span><span class="na">Authorize</span><span class="p">.</span><span class="na">newBuilder</span><span class="p">()</span><span class="w"></span>
<a id="__codelineno-3-4" name="__codelineno-3-4" href="#__codelineno-3-4"></a><span class="w">        </span><span class="p">.</span><span class="na">setId</span><span class="p">(</span><span class="s">&quot;identity-net:&quot;</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="n">UUID</span><span class="p">.</span><span class="na">randomUUID</span><span class="p">())</span><span class="w"></span>
<a id="__codelineno-3-5" name="__codelineno-3-5" href="#__codelineno-3-5"></a><span class="w">        </span><span class="p">.</span><span class="na">setGrant</span><span class="p">(</span><span class="s">&quot;identity-net:951002007l78123233&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-3-6" name="__codelineno-3-6" href="#__codelineno-3-6"></a><span class="w">        </span><span class="p">.</span><span class="na">addGranted</span><span class="p">(</span><span class="s">&quot;identity-net:usr-0&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-3-7" name="__codelineno-3-7" href="#__codelineno-3-7"></a><span class="w">        </span><span class="p">.</span><span class="na">addOpId</span><span class="p">(</span><span class="n">DigestUtils</span><span class="p">.</span><span class="na">sha256Hex</span><span class="p">(</span><span class="s">&quot;identity-net:RdidOperateAuthorizeTPL.signUpAllTypeCertificate&quot;</span><span class="p">))</span><span class="w"></span>
<a id="__codelineno-3-8" name="__codelineno-3-8" href="#__codelineno-3-8"></a><span class="w">        </span><span class="c1">// 设置是否可继续让渡</span><span class="w"></span>
<a id="__codelineno-3-9" name="__codelineno-3-9" href="#__codelineno-3-9"></a><span class="w">        </span><span class="p">.</span><span class="na">setIsTransfer</span><span class="p">(</span><span class="n">Peer</span><span class="p">.</span><span class="na">Authorize</span><span class="p">.</span><span class="na">TransferType</span><span class="p">.</span><span class="na">TRANSFER_REPEATEDLY</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-3-10" name="__codelineno-3-10" href="#__codelineno-3-10"></a><span class="w">        </span><span class="p">.</span><span class="na">setCreateTime</span><span class="p">(</span><span class="n">Timestamp</span><span class="p">.</span><span class="na">newBuilder</span><span class="p">().</span><span class="na">setSeconds</span><span class="p">(</span><span class="n">millis</span><span class="w"> </span><span class="o">/</span><span class="w"> </span><span class="mi">1000</span><span class="p">).</span><span class="na">setNanos</span><span class="p">((</span><span class="kt">int</span><span class="p">)</span><span class="w"> </span><span class="p">((</span><span class="n">millis</span><span class="w"> </span><span class="o">%</span><span class="w"> </span><span class="mi">1000</span><span class="p">)</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="mi">1000000</span><span class="p">)).</span><span class="na">build</span><span class="p">())</span><span class="w"></span>
<a id="__codelineno-3-11" name="__codelineno-3-11" href="#__codelineno-3-11"></a><span class="w">        </span><span class="p">.</span><span class="na">setAuthorizeValid</span><span class="p">(</span><span class="kc">true</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-3-12" name="__codelineno-3-12" href="#__codelineno-3-12"></a><span class="w">        </span><span class="p">.</span><span class="na">setVersion</span><span class="p">(</span><span class="s">&quot;1.0&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-3-13" name="__codelineno-3-13" href="#__codelineno-3-13"></a><span class="w">        </span><span class="p">.</span><span class="na">build</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-3-14" name="__codelineno-3-14" href="#__codelineno-3-14"></a><span class="n">String</span><span class="w"> </span><span class="n">tranId</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">UUID</span><span class="p">.</span><span class="na">randomUUID</span><span class="p">().</span><span class="na">toString</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-3-15" name="__codelineno-3-15" href="#__codelineno-3-15"></a><span class="c1">// 授权给usr-0</span><span class="w"></span>
<a id="__codelineno-3-16" name="__codelineno-3-16" href="#__codelineno-3-16"></a><span class="n">Peer</span><span class="p">.</span><span class="na">Transaction</span><span class="w"> </span><span class="n">tran</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">node1Creator</span><span class="p">.</span><span class="na">createInvokeTran</span><span class="p">(</span><span class="n">tranId</span><span class="p">,</span><span class="w"> </span><span class="n">superCertId</span><span class="p">,</span><span class="w"> </span><span class="n">didChaincodeId</span><span class="p">,</span><span class="w"> </span><span class="n">grantOperate</span><span class="p">,</span><span class="w"></span>
<a id="__codelineno-3-17" name="__codelineno-3-17" href="#__codelineno-3-17"></a><span class="w">        </span><span class="n">JSONObject</span><span class="p">.</span><span class="na">toJSONString</span><span class="p">(</span><span class="n">Collections</span><span class="p">.</span><span class="na">singletonList</span><span class="p">(</span><span class="n">JsonFormat</span><span class="p">.</span><span class="na">printer</span><span class="p">().</span><span class="na">print</span><span class="p">(</span><span class="n">authorize</span><span class="p">))),</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;&quot;</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-3-18" name="__codelineno-3-18" href="#__codelineno-3-18"></a><span class="n">postClient</span><span class="p">.</span><span class="na">postSignedTran</span><span class="p">(</span><span class="n">tran</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-3-19" name="__codelineno-3-19" href="#__codelineno-3-19"></a><span class="n">TimeUnit</span><span class="p">.</span><span class="na">SECONDS</span><span class="p">.</span><span class="na">sleep</span><span class="p">(</span><span class="mi">2</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-3-20" name="__codelineno-3-20" href="#__codelineno-3-20"></a><span class="n">Peer</span><span class="p">.</span><span class="na">TransactionResult</span><span class="w"> </span><span class="n">tranResult</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">getTransactionResult</span><span class="p">(</span><span class="n">tranId</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-3-21" name="__codelineno-3-21" href="#__codelineno-3-21"></a><span class="n">Peer</span><span class="p">.</span><span class="na">ActionResult</span><span class="w"> </span><span class="n">actionResult</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">tranResult</span><span class="p">.</span><span class="na">getErr</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-3-22" name="__codelineno-3-22" href="#__codelineno-3-22"></a><span class="n">Assertions</span><span class="p">.</span><span class="na">assertEquals</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="n">actionResult</span><span class="p">.</span><span class="na">getCode</span><span class="p">(),</span><span class="w"> </span><span class="s">&quot;没有错误，授权成功&quot;</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-3-23" name="__codelineno-3-23" href="#__codelineno-3-23"></a>
<a id="__codelineno-3-24" name="__codelineno-3-24" href="#__codelineno-3-24"></a><span class="c1">// step2: usr0为usr1 注册身份证书</span><span class="w"></span>
<a id="__codelineno-3-25" name="__codelineno-3-25" href="#__codelineno-3-25"></a><span class="n">Peer</span><span class="p">.</span><span class="na">Certificate</span><span class="w"> </span><span class="n">usr1_cert_1</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Peer</span><span class="p">.</span><span class="na">Certificate</span><span class="p">.</span><span class="na">newBuilder</span><span class="p">()</span><span class="w"></span>
<a id="__codelineno-3-26" name="__codelineno-3-26" href="#__codelineno-3-26"></a><span class="w">                    </span><span class="p">.</span><span class="na">setCertificate</span><span class="p">(</span><span class="n">certPem</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-3-27" name="__codelineno-3-27" href="#__codelineno-3-27"></a><span class="w">                    </span><span class="p">.</span><span class="na">setAlgType</span><span class="p">(</span><span class="s">&quot;sha256withecdsa&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-3-28" name="__codelineno-3-28" href="#__codelineno-3-28"></a><span class="w">                    </span><span class="p">.</span><span class="na">setCertValid</span><span class="p">(</span><span class="kc">true</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-3-29" name="__codelineno-3-29" href="#__codelineno-3-29"></a><span class="w">                                      </span><span class="c1">// 设置证书类型，证书类型为身份证书</span><span class="w"></span>
<a id="__codelineno-3-30" name="__codelineno-3-30" href="#__codelineno-3-30"></a><span class="w">                    </span><span class="p">.</span><span class="na">setCertType</span><span class="p">(</span><span class="n">Peer</span><span class="p">.</span><span class="na">Certificate</span><span class="p">.</span><span class="na">CertType</span><span class="p">.</span><span class="na">CERT_AUTHENTICATION</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-3-31" name="__codelineno-3-31" href="#__codelineno-3-31"></a><span class="w">                                      </span><span class="c1">// 证书名根据自己需要设置</span><span class="w"></span>
<a id="__codelineno-3-32" name="__codelineno-3-32" href="#__codelineno-3-32"></a><span class="w">                    </span><span class="p">.</span><span class="na">setId</span><span class="p">(</span><span class="n">Peer</span><span class="p">.</span><span class="na">CertId</span><span class="p">.</span><span class="na">newBuilder</span><span class="p">().</span><span class="na">setCreditCode</span><span class="p">(</span><span class="s">&quot;identity-net:usr-1&quot;</span><span class="p">).</span><span class="na">setCertName</span><span class="p">(</span><span class="s">&quot;0&quot;</span><span class="p">).</span><span class="na">build</span><span class="p">())</span><span class="w"></span>
<a id="__codelineno-3-33" name="__codelineno-3-33" href="#__codelineno-3-33"></a><span class="w">                    </span><span class="p">.</span><span class="na">setCertHash</span><span class="p">(</span><span class="n">DigestUtils</span><span class="p">.</span><span class="na">sha256Hex</span><span class="p">(</span><span class="n">certPem</span><span class="p">.</span><span class="na">replaceAll</span><span class="p">(</span><span class="s">&quot;\r\n|\r|\n|\\s&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;&quot;</span><span class="p">)))</span><span class="w"></span>
<a id="__codelineno-3-34" name="__codelineno-3-34" href="#__codelineno-3-34"></a><span class="w">                    </span><span class="p">.</span><span class="na">build</span><span class="p">();;</span><span class="w"></span>
<a id="__codelineno-3-35" name="__codelineno-3-35" href="#__codelineno-3-35"></a><span class="n">String</span><span class="w"> </span><span class="n">tranId_1</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">UUID</span><span class="p">.</span><span class="na">randomUUID</span><span class="p">().</span><span class="na">toString</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-3-36" name="__codelineno-3-36" href="#__codelineno-3-36"></a><span class="c1">// 构造交易</span><span class="w"></span>
<a id="__codelineno-3-37" name="__codelineno-3-37" href="#__codelineno-3-37"></a><span class="n">Peer</span><span class="p">.</span><span class="na">Transaction</span><span class="w"> </span><span class="n">tran_1</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">usr0_tranCreator_0</span><span class="p">.</span><span class="na">createInvokeTran</span><span class="p">(</span><span class="n">tranId_1</span><span class="p">,</span><span class="w"> </span><span class="n">usr0_certId_0</span><span class="p">,</span><span class="w"> </span><span class="n">didChaincodeId</span><span class="p">,</span><span class="w"> </span><span class="n">signUpAllTypeCertificate</span><span class="p">,</span><span class="w"> </span><span class="n">JsonFormat</span><span class="p">.</span><span class="na">printer</span><span class="p">().</span><span class="na">print</span><span class="p">(</span><span class="n">usr1_cert_1</span><span class="p">),</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;&quot;</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-3-38" name="__codelineno-3-38" href="#__codelineno-3-38"></a><span class="n">postClient</span><span class="p">.</span><span class="na">postSignedTran</span><span class="p">(</span><span class="n">tran_1</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-3-39" name="__codelineno-3-39" href="#__codelineno-3-39"></a><span class="n">TimeUnit</span><span class="p">.</span><span class="na">SECONDS</span><span class="p">.</span><span class="na">sleep</span><span class="p">(</span><span class="mi">2</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-3-40" name="__codelineno-3-40" href="#__codelineno-3-40"></a><span class="n">Peer</span><span class="p">.</span><span class="na">TransactionResult</span><span class="w"> </span><span class="n">tranResult_1</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">getTransactionResult</span><span class="p">(</span><span class="n">tranId_1</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-3-41" name="__codelineno-3-41" href="#__codelineno-3-41"></a><span class="n">Peer</span><span class="p">.</span><span class="na">ActionResult</span><span class="w"> </span><span class="n">actionResult_1</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">tranResult_1</span><span class="p">.</span><span class="na">getErr</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-3-42" name="__codelineno-3-42" href="#__codelineno-3-42"></a><span class="n">Assertions</span><span class="p">.</span><span class="na">assertEquals</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="n">tranResult_1</span><span class="p">.</span><span class="na">getErr</span><span class="p">().</span><span class="na">getCode</span><span class="p">(),</span><span class="w"> </span><span class="s">&quot;没有错误，注册成功&quot;</span><span class="p">);</span><span class="w"></span>
</code></pre></div>
<h4 id="_11">禁用/启用证书</h4>
<p>如果用户私钥丢失，或者不想再使用某个私钥，可以将在链上的、与私钥对应的证书禁用掉；后续找回或者想启用私钥时，可以恢复证书状态</p>
<ul>
<li>禁用/启用普通证书</li>
</ul>
<blockquote>
<p>用户使用自己<strong>身份证书</strong>对应的密钥构建的签名交易，可以调用<code>updateCertificateStatus</code>方法来修改<strong>自己</strong>账户下的普通证书的状态</p>
</blockquote>
<p>合约方法：<code>updateCertificateStatus</code>，公开，无需授权，任何注册用户均可调用，但是要注意，需使用自己<strong>身份证书对应的密钥</strong>来构建签名交易，并且只能修改<strong>自己</strong>账户下的普通证书状态</p>
<blockquote>
<p>举例说明：现有用户A，用户A想禁用用户A自己的普通证书</p>
<p>用户A调用<code>updateCertificateStatus</code>即可禁用自己的普通证书</p>
</blockquote>
<p><img alt="updateCertificateStatus" src="../img/updateCertificateStatus.png" /></p>
<ul>
<li>禁用/启用身份/普通证书</li>
</ul>
<p>合约方法：<code>updateAllTypeCertificateStatus</code>，非公开，需要授权，用户调用该方法可修改<strong>自己或其他人</strong>账户下的的身份证书或普通证书的状态</p>
<blockquote>
<p>举例说明：现有用户A、B，用户A想禁用用户A的普通证书，以及禁用用户B的身份证书</p>
<p>分析：首先用户A要取得可以调用<code>updateAllTypeCertificateStatus</code>的权限</p>
<p>可选方案之一：step1：superAmdin（或具有且可继续让渡该权限的其他用户）要先授权用户A调用<code>updateAllTypeCertificateStatus</code>的权限；step2：用户A调用<code>updateAllTypeCertificateStatus</code>禁用用户B的身份证书以及A的普通证书</p>
</blockquote>
<p><img alt="updateAllTypeCertificateStatus" src="../img/updateAllTypeCertificateStatus.png" /></p>
<h4 id="_12">代码示例</h4>
<p>测试用例：<a href="https://gitee.com/BTAJL/RCJava-core/blob/master/src/test/java/com/rcjava/did/CertOpeartionTest.java">https://gitee.com/BTAJL/RCJava-core/blob/master/src/test/java/com/rcjava/did/CertOpeartionTest.java</a></p>
<h3 id="_13">操作</h3>
<p>每个账户下可以有如下三类操作，且每个类型可以有多个操作</p>
<ul>
<li>部署合约、修改合约状态</li>
<li>合约中具体的某个方法</li>
<li>RepChain API中具体的某个接口</li>
</ul>
<p><img alt="oper" src="../img/oper.png" /></p>
<h4 id="_14">注册操作</h4>
<p>注册合约中具体的某个方法，只有注册之后，用户才可以通过签名交易调用该方法，并且将该操作授权给其他用户后，其他用户也得到了调用该方法的权限</p>
<ul>
<li>操作ID命名规范</li>
</ul>
<blockquote>
<p>sha256(操作名)，操作名的规范请参见下文</p>
</blockquote>
<ul>
<li>
<p>操作命名规范</p>
</li>
<li>
<p>API，只能由superAdmin来注册</p>
<ul>
<li><code>NetWorkID:transaction.postTranByString</code>，如：<code>"identity-net:transaction.postTranByString"</code></li>
</ul>
</li>
<li>部署合约，只能由superAdmin来注册，之后再授权给别的用户<ul>
<li><code>NetWorkID:ContractName.deploy</code>，如：<code>"identity-net:CredenceTPL.deploly"</code>，只能部署名为<code>CredenceTPL</code>的合约</li>
<li><code>NetWorkID:*.deploy</code>，如：<code>"identity-net:*.deploly"</code>，部署任何合约，在创世块中已注册到super_admin账户下</li>
</ul>
</li>
<li>修改合约状态，只能由superAdmin来注册，之后再授权给别的用户<ul>
<li><code>NetWorkID:ContractName.setState</code>，如：<code>"identity-net:CredenceTPL.setState"</code>，只能修改名为<code>CredenceTPL</code>的合约状态</li>
<li><code>NetWorkID:*.setState</code>，如：<code>"identity-net:*.setState"</code>，修改任何合约状态，在创世块中注册到super_admin账户下</li>
</ul>
</li>
<li>合约操作，<strong>具有合约部署权限</strong>的用户，就可以注册<ul>
<li><code>NetWorkID:ContractName.MethodName</code>，如：<code>"identity-net:CredenceTPL.proof"</code>，名为<code>CredenceTPL</code>的合约中的名为<code>proof</code>的方法</li>
</ul>
</li>
</ul>
<p>方法：<code>signUpOperate</code>，公开，无需授权，任何注册用户均可调用，但是要注意，用户想要注册某合约里的方法，有一个前提条件，即用户拥有该合约的部署权限。</p>
<blockquote>
<p>举例说明：现有用户A、B，用户A想部署合约TestProofTPL.scala，进而注册合约中的方法method_1，用户B想注册合约中的方法method_2</p>
<p>分析：只要用户A和用户B获得可以部署合约TestProofTPL.scala的权限即可</p>
<p>可选择方案之一：step1：superAmdin注册<code>"identity-net:TestProofTPL.deploy"</code>操作到自己账户；step2：授权用户A <code>"identity-net:TestProofTPL.deploy"</code>的权限，授予用户B <code>"identity-net:*.deploy"</code>的权限；step3：用户A部署合约TestProofTPL.scala；step4：用户A注册<code>"identity-net:TestProofTPL.method_1"</code>，用户B注册<code>"identity-net:TestProofTPL.method_2"</code></p>
</blockquote>
<p><img alt="signUpOperate" src="../img/signUpOperate.png" /></p>
<h4 id="_15">禁用/启用操作</h4>
<p>操作状态的修改具有全局性和传递性，即操作的注册者，将操作禁用后，所有被授权该操作的用户，后续都将无法使用该操作</p>
<p>方法：<code>updateOperateStatus</code>，公开，无需授权，任何用户均可调用，用户想要禁用合约里的某个方法，有一个前提条件，即用户拥有该合约的部署权限，如下图所示，账户B具有<code>"identity-net:*.deploly"</code>，账户A具有<code>"identity-net:cName.deploy"</code>，禁用操作后，所有用户均不可再调用执行cName.method_1与cName.method_2了</p>
<p><img alt="updateOperateStatus" src="../img/updateOperateStatus.png" /></p>
<h4 id="_16">代码示例</h4>
<p>测试用例：<a href="https://gitee.com/BTAJL/RCJava-core/blob/master/src/test/java/com/rcjava/did/OperOperationTest.java">https://gitee.com/BTAJL/RCJava-core/blob/master/src/test/java/com/rcjava/did/OperOperationTest.java</a></p>
<h3 id="_17">授权</h3>
<p>用户可将自己账户下的操作或别人让渡给自己的有效的且可以再次让渡的操作授权给别的用户，在RepChain的所有账户集合里，各个账户之间可以相互授权，每个授权都有唯一ID</p>
<p>授权ID命名规范</p>
<blockquote>
<p><code>NetWorkID:UUID</code>，如：<code>"identity-net:auth-usr-0-to-usr-1"</code></p>
</blockquote>
<p><img alt="auth" src="../img/auth.png" /></p>
<h4 id="_18">让渡操作</h4>
<p>方法：<code>grantOperate</code>，公开，无需授权，任何用户均可调用</p>
<blockquote>
<p>举例说明：账户B有操作<code>"identity-net:TestProofTPL.method_2"</code>，账户A有操作<code>"identity-net:TestProofTPL.method_1"</code>，账户B在为账户D授权时，设置为不可继续让渡，账户A为账户C授权时，设置为可继续让渡，因此最终D不可将<code>"identity-net:TestProofTPL.method_2"</code>继续让渡给账户E，而账户C可以继续将<code>"identity-net:TestProofTPL.method_1"</code>让渡给账户E</p>
</blockquote>
<p><img alt="grantOperate" src="../img/grantOperate.png" /></p>
<h4 id="_19">禁用/启用授权</h4>
<p>禁用/启用授权不具有全局性和传递性，假设A授权给B用户一个可以再次让渡的权限，B继续授权给C，A将给B的授权禁用，不影响C的使用</p>
<p>方法：<code>updateGrantOperateStatus</code>，公开，无需授权，任何用户均可调用</p>
<blockquote>
<p>举例说明：现有用户A，C，用户A想禁用用户A给C的某个授权</p>
<p>用户A调用<code>updateGrantOperateStatus</code>可禁用给C的授权<code>"identity-net:cName.method_1"</code>，之后C不可以再调用该方法</p>
</blockquote>
<p><img alt="updateGrantOperateStatus" src="../img/updateGrantOperateStatus.png" /></p>
<h4 id="_20">绑定授权到证书</h4>
<p>用户可将别的用户授予给自己的权限绑定到账户下的某个具体证书上，之后，用户使用该证书对应的私钥对构造的签名交易可通过该权限验证，其他证书对应的私钥构造的签名交易不可以通过该权限验证</p>
<p>方法：<code>bindCertToAuthorize</code>，公开，无需授权，任何用户均可调用</p>
<blockquote>
<p>举例说明：基于上一小节的权限让渡操作之后，现有用户C，用户C有两个证书"cert_0"和"cert_1"，两个证书分别对应的私钥"pri_1"与"pri_2"构造的签名交易都可以调用<code>"cName.method_1"</code>，当C将A授予给他的权限绑定到证书"cert_0"后，则只能"pri_1"构造的签名交易<strong>可以</strong>调用<code>"cName.method_1"</code>，"pri_2"构造的签名交易<strong>不可以</strong>调用<code>"cName.method_1"</code></p>
</blockquote>
<p><img alt="bindCertToAuthorize" src="../img/bindCertToAuthorize.png" /></p>
<h4 id="_21">代码示例</h4>
<p>测试用例：<a href="https://gitee.com/BTAJL/RCJava-core/blob/master/src/test/java/com/rcjava/did/AuthOperationTest.java">https://gitee.com/BTAJL/RCJava-core/blob/master/src/test/java/com/rcjava/did/AuthOperationTest.java</a></p>
<h2 id="sdk">SDK使用</h2>
<h3 id="rcjava-core">RCJava-core</h3>
<p><img alt="rcjava" src="../img/rcjava.png" /></p>
<p>新用户从注册上链到调用合约方法时，使用RCJava-core的逻辑如上图所示，该逻辑具有顺序性，后续操作需要在前置操作已完成的基础上进行。在身份链管理账户、证书以及操作权限，业务链只负责业务的多链模型中，以<code>identity-net:951002007l78123233</code>（super_admin）直接构造签名交易来调用权限管理合约为新用户usr-0（<code>"identity-net:usr-0"</code>）注册并授权为例，操作流程如下：</p>
<ul>
<li>step1：用户usr-0自己生成密钥对以及证书<code>usr-0_0.cer</code>（自签名或CA签发）</li>
<li>step2：用户usr-0将step1生成的证书<code>usr-0_0.cer</code>交给具有注册账户权限的用户（如super_admin）</li>
<li>step3：super_admin调用权限管理合约向身份链去注册用户usr-0，此步骤中usr-0的账户以及证书都被注册了</li>
<li>step4：super_admin向身份链去注册可以部署合约credence-net:CredenceTPL.deploy的操作</li>
<li>step5：super_admin授权给usr-0可部署合约credence-net:CredenceTPL.deploy的权限</li>
<li>step6：usr-0具有了向业务链部署CredenceTPL的权限，因此向业务链部署合约</li>
<li>step7：usr-0作为合约部署者，注册合约的某个方法</li>
<li>step8：usr-0调用业务链中刚部署的合约，存证数据</li>
</ul>
<p>上述流程的使用示例如下，完整代码请访问<a href="https://gitee.com/BTAJL/RCJava-core">RCJava-core</a>项目的<code>src\test\java\com\rcjava\did</code>目录：</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-4-1" name="__codelineno-4-1" href="#__codelineno-4-1"></a><span class="c1">//以下示例为身份链管理账户、证书以及操作权限，业务链只负责业务的多链模型，若为单链模式：</span><span class="w"></span>
<a id="__codelineno-4-2" name="__codelineno-4-2" href="#__codelineno-4-2"></a><span class="c1">//1.需将代码中的业务链前缀“credence-net”改为身份链前缀&quot;identity-net&quot;</span><span class="w"></span>
<a id="__codelineno-4-3" name="__codelineno-4-3" href="#__codelineno-4-3"></a><span class="c1">//2.需将提交至&lt;业务链&gt;“postCredenceClient”的交易改为“提交至&lt;身份链&gt;“postClient”</span><span class="w"></span>
<a id="__codelineno-4-4" name="__codelineno-4-4" href="#__codelineno-4-4"></a><span class="nd">@TestMethodOrder</span><span class="p">(</span><span class="n">MethodOrderer</span><span class="p">.</span><span class="na">OrderAnnotation</span><span class="p">.</span><span class="na">class</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-5" name="__codelineno-4-5" href="#__codelineno-4-5"></a><span class="nd">@TestInstance</span><span class="p">(</span><span class="n">TestInstance</span><span class="p">.</span><span class="na">Lifecycle</span><span class="p">.</span><span class="na">PER_CLASS</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-6" name="__codelineno-4-6" href="#__codelineno-4-6"></a><span class="kd">public</span><span class="w"> </span><span class="kd">class</span> <span class="nc">Test</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<a id="__codelineno-4-7" name="__codelineno-4-7" href="#__codelineno-4-7"></a>
<a id="__codelineno-4-8" name="__codelineno-4-8" href="#__codelineno-4-8"></a><span class="w">    </span><span class="c1">// 身份链</span><span class="w"></span>
<a id="__codelineno-4-9" name="__codelineno-4-9" href="#__codelineno-4-9"></a><span class="w">    </span><span class="n">TranPostClient</span><span class="w"> </span><span class="n">postClient</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">new</span><span class="w"> </span><span class="n">TranPostClient</span><span class="p">(</span><span class="s">&quot;localhost:9081&quot;</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-4-10" name="__codelineno-4-10" href="#__codelineno-4-10"></a><span class="w">    </span><span class="n">ChainInfoClient</span><span class="w"> </span><span class="n">infoClient</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">new</span><span class="w"> </span><span class="n">ChainInfoClient</span><span class="p">(</span><span class="s">&quot;localhost:9081&quot;</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-4-11" name="__codelineno-4-11" href="#__codelineno-4-11"></a>
<a id="__codelineno-4-12" name="__codelineno-4-12" href="#__codelineno-4-12"></a><span class="w">    </span><span class="c1">// 业务链</span><span class="w"></span>
<a id="__codelineno-4-13" name="__codelineno-4-13" href="#__codelineno-4-13"></a><span class="w">    </span><span class="n">TranPostClient</span><span class="w"> </span><span class="n">postCredenceClient</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">new</span><span class="w"> </span><span class="n">TranPostClient</span><span class="p">(</span><span class="s">&quot;localhost:9086&quot;</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-4-14" name="__codelineno-4-14" href="#__codelineno-4-14"></a><span class="w">    </span><span class="n">ChainInfoClient</span><span class="w"> </span><span class="n">infoCredenceClient</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">new</span><span class="w"> </span><span class="n">ChainInfoClient</span><span class="p">(</span><span class="s">&quot;localhost:9086&quot;</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-4-15" name="__codelineno-4-15" href="#__codelineno-4-15"></a>
<a id="__codelineno-4-16" name="__codelineno-4-16" href="#__codelineno-4-16"></a><span class="w">    </span><span class="c1">// superAdmin</span><span class="w"></span>
<a id="__codelineno-4-17" name="__codelineno-4-17" href="#__codelineno-4-17"></a><span class="w">    </span><span class="n">TranCreator</span><span class="w"> </span><span class="n">superCreator</span><span class="p">;</span><span class="w"></span>
<a id="__codelineno-4-18" name="__codelineno-4-18" href="#__codelineno-4-18"></a><span class="w">    </span><span class="n">Peer</span><span class="p">.</span><span class="na">CertId</span><span class="w"> </span><span class="n">superCertId</span><span class="p">;</span><span class="w"></span>
<a id="__codelineno-4-19" name="__codelineno-4-19" href="#__codelineno-4-19"></a>
<a id="__codelineno-4-20" name="__codelineno-4-20" href="#__codelineno-4-20"></a><span class="w">    </span><span class="c1">// 新用户usr0</span><span class="w"></span>
<a id="__codelineno-4-21" name="__codelineno-4-21" href="#__codelineno-4-21"></a><span class="w">    </span><span class="n">TranCreator</span><span class="w"> </span><span class="n">usr0_tranCreator_0</span><span class="p">;</span><span class="w"></span>
<a id="__codelineno-4-22" name="__codelineno-4-22" href="#__codelineno-4-22"></a><span class="w">    </span><span class="n">Peer</span><span class="p">.</span><span class="na">CertId</span><span class="w"> </span><span class="n">usr0_certId_0</span><span class="p">;</span><span class="w"></span>
<a id="__codelineno-4-23" name="__codelineno-4-23" href="#__codelineno-4-23"></a>
<a id="__codelineno-4-24" name="__codelineno-4-24" href="#__codelineno-4-24"></a><span class="w">    </span><span class="c1">//账户权限管理合约</span><span class="w"></span>
<a id="__codelineno-4-25" name="__codelineno-4-25" href="#__codelineno-4-25"></a><span class="w">    </span><span class="n">Peer</span><span class="p">.</span><span class="na">ChaincodeId</span><span class="w"> </span><span class="n">didChaincodeId</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Peer</span><span class="p">.</span><span class="na">ChaincodeId</span><span class="p">.</span><span class="na">newBuilder</span><span class="p">().</span><span class="na">setChaincodeName</span><span class="p">(</span><span class="s">&quot;RdidOperateAuthorizeTPL&quot;</span><span class="p">).</span><span class="na">setVersion</span><span class="p">(</span><span class="mi">1</span><span class="p">).</span><span class="na">build</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-4-26" name="__codelineno-4-26" href="#__codelineno-4-26"></a><span class="w">    </span><span class="n">Peer</span><span class="p">.</span><span class="na">ChaincodeId</span><span class="w"> </span><span class="n">credenceTPLId</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Peer</span><span class="p">.</span><span class="na">ChaincodeId</span><span class="p">.</span><span class="na">newBuilder</span><span class="p">().</span><span class="na">setChaincodeName</span><span class="p">(</span><span class="s">&quot;CredenceTPL&quot;</span><span class="p">).</span><span class="na">setVersion</span><span class="p">(</span><span class="mi">1</span><span class="p">).</span><span class="na">build</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-4-27" name="__codelineno-4-27" href="#__codelineno-4-27"></a>
<a id="__codelineno-4-28" name="__codelineno-4-28" href="#__codelineno-4-28"></a>
<a id="__codelineno-4-29" name="__codelineno-4-29" href="#__codelineno-4-29"></a><span class="w">    </span><span class="nd">@BeforeAll</span><span class="w"></span>
<a id="__codelineno-4-30" name="__codelineno-4-30" href="#__codelineno-4-30"></a><span class="w">    </span><span class="kt">void</span><span class="w"> </span><span class="nf">init</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<a id="__codelineno-4-31" name="__codelineno-4-31" href="#__codelineno-4-31"></a><span class="w">        </span><span class="c1">//构造管理员的私钥</span><span class="w"></span>
<a id="__codelineno-4-32" name="__codelineno-4-32" href="#__codelineno-4-32"></a><span class="w">        </span><span class="n">PrivateKey</span><span class="w"> </span><span class="n">super_pri</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">CertUtil</span><span class="p">.</span><span class="na">genX509CertPrivateKey</span><span class="p">(</span><span class="k">new</span><span class="w"> </span><span class="n">File</span><span class="p">(</span><span class="s">&quot;jks/test/multi_chain/identity.951002007l78123233.super_admin.jks&quot;</span><span class="p">),</span><span class="w"></span>
<a id="__codelineno-4-33" name="__codelineno-4-33" href="#__codelineno-4-33"></a><span class="w">                </span><span class="s">&quot;super_admin&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;951002007l78123233.super_admin&quot;</span><span class="p">).</span><span class="na">getPrivateKey</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-4-34" name="__codelineno-4-34" href="#__codelineno-4-34"></a><span class="w">        </span><span class="n">superCreator</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">TranCreator</span><span class="p">.</span><span class="na">newBuilder</span><span class="p">().</span><span class="na">setPrivateKey</span><span class="p">(</span><span class="n">super_pri</span><span class="p">).</span><span class="na">setSignAlgorithm</span><span class="p">(</span><span class="s">&quot;SHA256withECDSA&quot;</span><span class="p">).</span><span class="na">build</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-4-35" name="__codelineno-4-35" href="#__codelineno-4-35"></a><span class="w">        </span><span class="n">superCertId</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Peer</span><span class="p">.</span><span class="na">CertId</span><span class="p">.</span><span class="na">newBuilder</span><span class="p">().</span><span class="na">setCreditCode</span><span class="p">(</span><span class="s">&quot;identity-net:951002007l78123233&quot;</span><span class="p">).</span><span class="na">setCertName</span><span class="p">(</span><span class="s">&quot;super_admin&quot;</span><span class="p">).</span><span class="na">build</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-4-36" name="__codelineno-4-36" href="#__codelineno-4-36"></a>
<a id="__codelineno-4-37" name="__codelineno-4-37" href="#__codelineno-4-37"></a><span class="w">        </span><span class="c1">//构造usr0的私钥</span><span class="w"></span>
<a id="__codelineno-4-38" name="__codelineno-4-38" href="#__codelineno-4-38"></a><span class="w">        </span><span class="c1">//使用KeyStoreExplorer工具或者使用代码实例(https://gitee.com/BTAJL/RCJava-core/blob/master/src/main/java/com/rcjava/util/CertUtil.java)即可生成密钥对，导出证书</span><span class="w"></span>
<a id="__codelineno-4-39" name="__codelineno-4-39" href="#__codelineno-4-39"></a><span class="w">        </span><span class="n">PrivateKey</span><span class="w"> </span><span class="n">usr0_pri</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">CertUtil</span><span class="p">.</span><span class="na">genX509CertPrivateKey</span><span class="p">(</span><span class="k">new</span><span class="w"> </span><span class="n">File</span><span class="p">(</span><span class="s">&quot;jks/test/did/usr-0_0.jks&quot;</span><span class="p">),</span><span class="w"> </span><span class="s">&quot;123&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;usr_0_0&quot;</span><span class="p">).</span><span class="na">getPrivateKey</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-4-40" name="__codelineno-4-40" href="#__codelineno-4-40"></a><span class="w">        </span><span class="n">usr0_tranCreator_0</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">TranCreator</span><span class="p">.</span><span class="na">newBuilder</span><span class="p">().</span><span class="na">setPrivateKey</span><span class="p">(</span><span class="n">usr0_pri</span><span class="p">).</span><span class="na">setSignAlgorithm</span><span class="p">(</span><span class="s">&quot;SHA256withECDSA&quot;</span><span class="p">).</span><span class="na">build</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-4-41" name="__codelineno-4-41" href="#__codelineno-4-41"></a><span class="w">        </span><span class="n">usr0_certId_0</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Peer</span><span class="p">.</span><span class="na">CertId</span><span class="p">.</span><span class="na">newBuilder</span><span class="p">().</span><span class="na">setCreditCode</span><span class="p">(</span><span class="s">&quot;credence-net:usr-0&quot;</span><span class="p">).</span><span class="na">setCertName</span><span class="p">(</span><span class="s">&quot;0&quot;</span><span class="p">).</span><span class="na">build</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-4-42" name="__codelineno-4-42" href="#__codelineno-4-42"></a><span class="w">    </span><span class="p">}</span><span class="w"></span>
<a id="__codelineno-4-43" name="__codelineno-4-43" href="#__codelineno-4-43"></a>
<a id="__codelineno-4-44" name="__codelineno-4-44" href="#__codelineno-4-44"></a><span class="w">    </span><span class="nd">@Test</span><span class="w"></span>
<a id="__codelineno-4-45" name="__codelineno-4-45" href="#__codelineno-4-45"></a><span class="w">    </span><span class="nd">@DisplayName</span><span class="p">(</span><span class="s">&quot;super_admin向身份链去注册用户usr-0，该步骤注册了usr-0的账户以及证书&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-46" name="__codelineno-4-46" href="#__codelineno-4-46"></a><span class="w">    </span><span class="nd">@Order</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-47" name="__codelineno-4-47" href="#__codelineno-4-47"></a><span class="w">       </span><span class="kt">void</span><span class="w"> </span><span class="nf">signUpSignerTest</span><span class="p">()</span><span class="w"> </span><span class="kd">throws</span><span class="w"> </span><span class="n">InterruptedException</span><span class="p">,</span><span class="w"> </span><span class="n">IOException</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<a id="__codelineno-4-48" name="__codelineno-4-48" href="#__codelineno-4-48"></a>
<a id="__codelineno-4-49" name="__codelineno-4-49" href="#__codelineno-4-49"></a><span class="w">        </span><span class="c1">// 证书pem字符串</span><span class="w"></span>
<a id="__codelineno-4-50" name="__codelineno-4-50" href="#__codelineno-4-50"></a><span class="w">        </span><span class="n">String</span><span class="w"> </span><span class="n">certPem</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">new</span><span class="w"> </span><span class="n">String</span><span class="p">(</span><span class="n">Files</span><span class="p">.</span><span class="na">readAllBytes</span><span class="p">(</span><span class="k">new</span><span class="w"> </span><span class="n">File</span><span class="p">(</span><span class="s">&quot;jks/test/did/usr-0_0.cer&quot;</span><span class="p">).</span><span class="na">toPath</span><span class="p">()));</span><span class="w"></span>
<a id="__codelineno-4-51" name="__codelineno-4-51" href="#__codelineno-4-51"></a><span class="w">        </span><span class="n">Peer</span><span class="p">.</span><span class="na">Certificate</span><span class="w"> </span><span class="n">cert_proto</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Peer</span><span class="p">.</span><span class="na">Certificate</span><span class="p">.</span><span class="na">newBuilder</span><span class="p">()</span><span class="w"></span>
<a id="__codelineno-4-52" name="__codelineno-4-52" href="#__codelineno-4-52"></a><span class="w">                </span><span class="c1">// 新用户usr-0的证书</span><span class="w"></span>
<a id="__codelineno-4-53" name="__codelineno-4-53" href="#__codelineno-4-53"></a><span class="w">                </span><span class="p">.</span><span class="na">setCertificate</span><span class="p">(</span><span class="n">certPem</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-54" name="__codelineno-4-54" href="#__codelineno-4-54"></a><span class="w">                </span><span class="p">.</span><span class="na">setAlgType</span><span class="p">(</span><span class="s">&quot;sha256withecdsa&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-55" name="__codelineno-4-55" href="#__codelineno-4-55"></a><span class="w">                </span><span class="p">.</span><span class="na">setCertValid</span><span class="p">(</span><span class="kc">true</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-56" name="__codelineno-4-56" href="#__codelineno-4-56"></a><span class="w">                </span><span class="p">.</span><span class="na">setCertType</span><span class="p">(</span><span class="n">Peer</span><span class="p">.</span><span class="na">Certificate</span><span class="p">.</span><span class="na">CertType</span><span class="p">.</span><span class="na">CERT_AUTHENTICATION</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-57" name="__codelineno-4-57" href="#__codelineno-4-57"></a><span class="w">                </span><span class="p">.</span><span class="na">setId</span><span class="p">(</span><span class="n">Peer</span><span class="p">.</span><span class="na">CertId</span><span class="p">.</span><span class="na">newBuilder</span><span class="p">().</span><span class="na">setCreditCode</span><span class="p">(</span><span class="s">&quot;credence-net:usr-0&quot;</span><span class="p">).</span><span class="na">setCertName</span><span class="p">(</span><span class="s">&quot;0&quot;</span><span class="p">).</span><span class="na">build</span><span class="p">())</span><span class="w"></span>
<a id="__codelineno-4-58" name="__codelineno-4-58" href="#__codelineno-4-58"></a><span class="w">                </span><span class="p">.</span><span class="na">setCertHash</span><span class="p">(</span><span class="n">DigestUtils</span><span class="p">.</span><span class="na">sha256Hex</span><span class="p">(</span><span class="n">certPem</span><span class="p">.</span><span class="na">replaceAll</span><span class="p">(</span><span class="s">&quot;\r\n|\r|\n|\\s&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;&quot;</span><span class="p">)))</span><span class="w"></span>
<a id="__codelineno-4-59" name="__codelineno-4-59" href="#__codelineno-4-59"></a><span class="w">                </span><span class="p">.</span><span class="na">build</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-4-60" name="__codelineno-4-60" href="#__codelineno-4-60"></a>
<a id="__codelineno-4-61" name="__codelineno-4-61" href="#__codelineno-4-61"></a><span class="w">        </span><span class="n">Peer</span><span class="p">.</span><span class="na">Signer</span><span class="w"> </span><span class="n">usr0_signer</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Peer</span><span class="p">.</span><span class="na">Signer</span><span class="p">.</span><span class="na">newBuilder</span><span class="p">()</span><span class="w"></span>
<a id="__codelineno-4-62" name="__codelineno-4-62" href="#__codelineno-4-62"></a><span class="w">                </span><span class="p">.</span><span class="na">setName</span><span class="p">(</span><span class="s">&quot;usr-0&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-63" name="__codelineno-4-63" href="#__codelineno-4-63"></a><span class="w">                </span><span class="c1">// 新用户usr-0的账户ID</span><span class="w"></span>
<a id="__codelineno-4-64" name="__codelineno-4-64" href="#__codelineno-4-64"></a><span class="w">                </span><span class="p">.</span><span class="na">setCreditCode</span><span class="p">(</span><span class="s">&quot;credence-net:usr-0&quot;</span><span class="p">)</span><span class="w"> </span><span class="c1">// 新注册用户   业务链前缀，credence-net:*****.usr-11</span><span class="w"></span>
<a id="__codelineno-4-65" name="__codelineno-4-65" href="#__codelineno-4-65"></a><span class="w">                </span><span class="p">.</span><span class="na">setMobile</span><span class="p">(</span><span class="s">&quot;18888888888&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-66" name="__codelineno-4-66" href="#__codelineno-4-66"></a><span class="w">                </span><span class="p">.</span><span class="na">addAllAuthenticationCerts</span><span class="p">(</span><span class="n">Collections</span><span class="p">.</span><span class="na">singletonList</span><span class="p">(</span><span class="n">cert_proto</span><span class="p">))</span><span class="w"></span>
<a id="__codelineno-4-67" name="__codelineno-4-67" href="#__codelineno-4-67"></a><span class="w">                </span><span class="p">.</span><span class="na">setSignerValid</span><span class="p">(</span><span class="kc">true</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-68" name="__codelineno-4-68" href="#__codelineno-4-68"></a><span class="w">                </span><span class="p">.</span><span class="na">build</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-4-69" name="__codelineno-4-69" href="#__codelineno-4-69"></a>
<a id="__codelineno-4-70" name="__codelineno-4-70" href="#__codelineno-4-70"></a><span class="w">        </span><span class="c1">// super_admin向身份链提交交易，注册用户，以便在业务链使用</span><span class="w"></span>
<a id="__codelineno-4-71" name="__codelineno-4-71" href="#__codelineno-4-71"></a><span class="w">        </span><span class="n">String</span><span class="w"> </span><span class="n">tranId_1</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">UUID</span><span class="p">.</span><span class="na">randomUUID</span><span class="p">().</span><span class="na">toString</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-4-72" name="__codelineno-4-72" href="#__codelineno-4-72"></a><span class="w">        </span><span class="n">Peer</span><span class="p">.</span><span class="na">Transaction</span><span class="w"> </span><span class="n">tran_1</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">superCreator</span><span class="p">.</span><span class="na">createInvokeTran</span><span class="p">(</span><span class="n">tranId_1</span><span class="p">,</span><span class="w"> </span><span class="n">superCertId</span><span class="p">,</span><span class="w"> </span><span class="n">didChaincodeId</span><span class="p">,</span><span class="w"> </span><span class="n">signUpSigner</span><span class="p">,</span><span class="w"> </span><span class="n">JsonFormat</span><span class="p">.</span><span class="na">printer</span><span class="p">().</span><span class="na">print</span><span class="p">(</span><span class="n">usr0_signer</span><span class="p">),</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;&quot;</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-4-73" name="__codelineno-4-73" href="#__codelineno-4-73"></a><span class="w">        </span><span class="n">postClient</span><span class="p">.</span><span class="na">postSignedTran</span><span class="p">(</span><span class="n">tran_1</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-4-74" name="__codelineno-4-74" href="#__codelineno-4-74"></a><span class="w">        </span><span class="n">TimeUnit</span><span class="p">.</span><span class="na">SECONDS</span><span class="p">.</span><span class="na">sleep</span><span class="p">(</span><span class="mi">5</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-4-75" name="__codelineno-4-75" href="#__codelineno-4-75"></a><span class="w">        </span><span class="n">Peer</span><span class="p">.</span><span class="na">TransactionResult</span><span class="w"> </span><span class="n">tranResult_1</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">infoClient</span><span class="p">.</span><span class="na">getTranResultByTranId</span><span class="p">(</span><span class="n">tranId_1</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-4-76" name="__codelineno-4-76" href="#__codelineno-4-76"></a><span class="w">        </span><span class="n">Assertions</span><span class="p">.</span><span class="na">assertEquals</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="n">tranResult_1</span><span class="p">.</span><span class="na">getErr</span><span class="p">().</span><span class="na">getCode</span><span class="p">(),</span><span class="w"> </span><span class="s">&quot;没有错误，注册成功&quot;</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-4-77" name="__codelineno-4-77" href="#__codelineno-4-77"></a><span class="w">    </span><span class="p">}</span><span class="w"></span>
<a id="__codelineno-4-78" name="__codelineno-4-78" href="#__codelineno-4-78"></a>
<a id="__codelineno-4-79" name="__codelineno-4-79" href="#__codelineno-4-79"></a><span class="w">    </span><span class="nd">@Test</span><span class="w"></span>
<a id="__codelineno-4-80" name="__codelineno-4-80" href="#__codelineno-4-80"></a><span class="w">    </span><span class="nd">@DisplayName</span><span class="p">(</span><span class="s">&quot;super_admin注册Operate-可以部署合约CredenceTPL.deploy的操作&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-81" name="__codelineno-4-81" href="#__codelineno-4-81"></a><span class="w">    </span><span class="nd">@Order</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-82" name="__codelineno-4-82" href="#__codelineno-4-82"></a><span class="w">    </span><span class="kt">void</span><span class="w"> </span><span class="nf">signUpOperate</span><span class="p">()</span><span class="w"> </span><span class="kd">throws</span><span class="w"> </span><span class="n">InterruptedException</span><span class="p">,</span><span class="w"> </span><span class="n">IOException</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<a id="__codelineno-4-83" name="__codelineno-4-83" href="#__codelineno-4-83"></a>
<a id="__codelineno-4-84" name="__codelineno-4-84" href="#__codelineno-4-84"></a><span class="w">        </span><span class="c1">// super_admin注册部署合约credence-net:CredenceTPL.deploy的操作，向&lt;身份链&gt;提交</span><span class="w"></span>
<a id="__codelineno-4-85" name="__codelineno-4-85" href="#__codelineno-4-85"></a><span class="w">        </span><span class="c1">//若为身份链管理账户、证书，业务链管理操作权限并负责业务的多链模型，则向&lt;业务链&gt;提交，将该段代码中的身份链前缀&quot;identity-net&quot;改为业务链前缀“credence-net”</span><span class="w"></span>
<a id="__codelineno-4-86" name="__codelineno-4-86" href="#__codelineno-4-86"></a><span class="w">        </span><span class="c1">//将提交至&lt;身份链&gt;“postClient”的交易改为“提交至&lt;业务链&gt;“postCredenceClient”</span><span class="w"></span>
<a id="__codelineno-4-87" name="__codelineno-4-87" href="#__codelineno-4-87"></a><span class="w">        </span><span class="kt">long</span><span class="w"> </span><span class="n">millis_1</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">System</span><span class="p">.</span><span class="na">currentTimeMillis</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-4-88" name="__codelineno-4-88" href="#__codelineno-4-88"></a><span class="w">        </span><span class="n">Peer</span><span class="p">.</span><span class="na">Operate</span><span class="w"> </span><span class="n">operate</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Peer</span><span class="p">.</span><span class="na">Operate</span><span class="p">.</span><span class="na">newBuilder</span><span class="p">()</span><span class="w"></span>
<a id="__codelineno-4-89" name="__codelineno-4-89" href="#__codelineno-4-89"></a><span class="w">                </span><span class="p">.</span><span class="na">setOpId</span><span class="p">(</span><span class="n">DigestUtils</span><span class="p">.</span><span class="na">sha256Hex</span><span class="p">(</span><span class="s">&quot;credence-net:CredenceTPL.deploy&quot;</span><span class="p">))</span><span class="w"></span>
<a id="__codelineno-4-90" name="__codelineno-4-90" href="#__codelineno-4-90"></a><span class="w">                </span><span class="p">.</span><span class="na">setDescription</span><span class="p">(</span><span class="s">&quot;部署存证合约-CredenceTPL的权限&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-91" name="__codelineno-4-91" href="#__codelineno-4-91"></a><span class="w">                </span><span class="p">.</span><span class="na">setRegister</span><span class="p">(</span><span class="s">&quot;identity-net:951002007l78123233&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-92" name="__codelineno-4-92" href="#__codelineno-4-92"></a><span class="w">                </span><span class="p">.</span><span class="na">setIsPublish</span><span class="p">(</span><span class="kc">false</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-93" name="__codelineno-4-93" href="#__codelineno-4-93"></a><span class="w">                </span><span class="p">.</span><span class="na">setOperateType</span><span class="p">(</span><span class="n">Peer</span><span class="p">.</span><span class="na">Operate</span><span class="p">.</span><span class="na">OperateType</span><span class="p">.</span><span class="na">OPERATE_CONTRACT</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-94" name="__codelineno-4-94" href="#__codelineno-4-94"></a><span class="w">                </span><span class="p">.</span><span class="na">setAuthFullName</span><span class="p">(</span><span class="s">&quot;credence-net:CredenceTPL.deploy&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-95" name="__codelineno-4-95" href="#__codelineno-4-95"></a><span class="w">                </span><span class="p">.</span><span class="na">setCreateTime</span><span class="p">(</span><span class="n">Timestamp</span><span class="p">.</span><span class="na">newBuilder</span><span class="p">().</span><span class="na">setSeconds</span><span class="p">(</span><span class="n">millis_1</span><span class="w"> </span><span class="o">/</span><span class="w"> </span><span class="mi">1000</span><span class="p">).</span><span class="na">setNanos</span><span class="p">((</span><span class="kt">int</span><span class="p">)</span><span class="w"> </span><span class="p">((</span><span class="n">millis_1</span><span class="w"> </span><span class="o">%</span><span class="w"> </span><span class="mi">1000</span><span class="p">)</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="mi">1000000</span><span class="p">)).</span><span class="na">build</span><span class="p">())</span><span class="w"></span>
<a id="__codelineno-4-96" name="__codelineno-4-96" href="#__codelineno-4-96"></a><span class="w">                </span><span class="p">.</span><span class="na">setOpValid</span><span class="p">(</span><span class="kc">true</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-97" name="__codelineno-4-97" href="#__codelineno-4-97"></a><span class="w">                </span><span class="p">.</span><span class="na">setVersion</span><span class="p">(</span><span class="s">&quot;1.0&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-98" name="__codelineno-4-98" href="#__codelineno-4-98"></a><span class="w">                </span><span class="p">.</span><span class="na">build</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-4-99" name="__codelineno-4-99" href="#__codelineno-4-99"></a><span class="w">        </span><span class="n">String</span><span class="w"> </span><span class="n">tranId_2</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">UUID</span><span class="p">.</span><span class="na">randomUUID</span><span class="p">().</span><span class="na">toString</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-4-100" name="__codelineno-4-100" href="#__codelineno-4-100"></a><span class="w">        </span><span class="n">Peer</span><span class="p">.</span><span class="na">Transaction</span><span class="w"> </span><span class="n">tran_2</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">superCreator</span><span class="p">.</span><span class="na">createInvokeTran</span><span class="p">(</span><span class="n">tranId_2</span><span class="p">,</span><span class="w"> </span><span class="n">superCertId</span><span class="p">,</span><span class="w"> </span><span class="n">didChaincodeId</span><span class="p">,</span><span class="w"> </span><span class="n">signUpOperate</span><span class="p">,</span><span class="w"> </span><span class="n">JsonFormat</span><span class="p">.</span><span class="na">printer</span><span class="p">().</span><span class="na">print</span><span class="p">(</span><span class="n">operate</span><span class="p">),</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;&quot;</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-4-101" name="__codelineno-4-101" href="#__codelineno-4-101"></a><span class="w">        </span><span class="n">postClient</span><span class="p">.</span><span class="na">postSignedTran</span><span class="p">(</span><span class="n">tran_2</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-4-102" name="__codelineno-4-102" href="#__codelineno-4-102"></a><span class="w">        </span><span class="n">TimeUnit</span><span class="p">.</span><span class="na">SECONDS</span><span class="p">.</span><span class="na">sleep</span><span class="p">(</span><span class="mi">5</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-4-103" name="__codelineno-4-103" href="#__codelineno-4-103"></a><span class="w">        </span><span class="n">Peer</span><span class="p">.</span><span class="na">TransactionResult</span><span class="w"> </span><span class="n">tranResult_2</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">infoClient</span><span class="p">.</span><span class="na">getTranResultByTranId</span><span class="p">(</span><span class="n">tranId_2</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-4-104" name="__codelineno-4-104" href="#__codelineno-4-104"></a><span class="w">        </span><span class="n">Peer</span><span class="p">.</span><span class="na">ActionResult</span><span class="w"> </span><span class="n">actionResult_2</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">tranResult_2</span><span class="p">.</span><span class="na">getErr</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-4-105" name="__codelineno-4-105" href="#__codelineno-4-105"></a><span class="w">        </span><span class="n">Assertions</span><span class="p">.</span><span class="na">assertEquals</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="n">actionResult_2</span><span class="p">.</span><span class="na">getCode</span><span class="p">(),</span><span class="w"> </span><span class="s">&quot;没有错误，操作注册成功&quot;</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-4-106" name="__codelineno-4-106" href="#__codelineno-4-106"></a>
<a id="__codelineno-4-107" name="__codelineno-4-107" href="#__codelineno-4-107"></a><span class="w">    </span><span class="p">}</span><span class="w"></span>
<a id="__codelineno-4-108" name="__codelineno-4-108" href="#__codelineno-4-108"></a>
<a id="__codelineno-4-109" name="__codelineno-4-109" href="#__codelineno-4-109"></a><span class="w">    </span><span class="nd">@Test</span><span class="w"></span>
<a id="__codelineno-4-110" name="__codelineno-4-110" href="#__codelineno-4-110"></a><span class="w">    </span><span class="nd">@DisplayName</span><span class="p">(</span><span class="s">&quot;super_admin授权给credence-net:usr-0可部署CredenceTPL的权限&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-111" name="__codelineno-4-111" href="#__codelineno-4-111"></a><span class="w">    </span><span class="nd">@Order</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-112" name="__codelineno-4-112" href="#__codelineno-4-112"></a><span class="w">    </span><span class="kt">void</span><span class="w"> </span><span class="nf">grantOperate</span><span class="p">()</span><span class="w"> </span><span class="kd">throws</span><span class="w"> </span><span class="n">InterruptedException</span><span class="p">,</span><span class="w"> </span><span class="n">IOException</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<a id="__codelineno-4-113" name="__codelineno-4-113" href="#__codelineno-4-113"></a>
<a id="__codelineno-4-114" name="__codelineno-4-114" href="#__codelineno-4-114"></a><span class="w">        </span><span class="c1">//super_admin授权给usr0部署合约(&quot;credence-net:CredenceTPL.deploy&quot;)的权限，向&lt;身份链&gt;提交</span><span class="w"></span>
<a id="__codelineno-4-115" name="__codelineno-4-115" href="#__codelineno-4-115"></a><span class="w">        </span><span class="c1">//若为身份链管理账户、证书，业务链管理操作权限并负责业务的多链模型，则向&lt;业务链&gt;提交，将该段代码中的身份链前缀&quot;identity-net&quot;改为业务链前缀“credence-net”</span><span class="w"></span>
<a id="__codelineno-4-116" name="__codelineno-4-116" href="#__codelineno-4-116"></a><span class="w">        </span><span class="c1">//将提交至&lt;身份链&gt;“postClient”的交易改为“提交至&lt;业务链&gt;“postCredenceClient”</span><span class="w"></span>
<a id="__codelineno-4-117" name="__codelineno-4-117" href="#__codelineno-4-117"></a><span class="w">        </span><span class="kt">long</span><span class="w"> </span><span class="n">millis</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">System</span><span class="p">.</span><span class="na">currentTimeMillis</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-4-118" name="__codelineno-4-118" href="#__codelineno-4-118"></a><span class="w">        </span><span class="n">Peer</span><span class="p">.</span><span class="na">Authorize</span><span class="w"> </span><span class="n">authorize_1</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Peer</span><span class="p">.</span><span class="na">Authorize</span><span class="p">.</span><span class="na">newBuilder</span><span class="p">()</span><span class="w"></span>
<a id="__codelineno-4-119" name="__codelineno-4-119" href="#__codelineno-4-119"></a><span class="w">                </span><span class="p">.</span><span class="na">setId</span><span class="p">(</span><span class="s">&quot;credence-net:&quot;</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="n">UUID</span><span class="p">.</span><span class="na">randomUUID</span><span class="p">())</span><span class="w"></span>
<a id="__codelineno-4-120" name="__codelineno-4-120" href="#__codelineno-4-120"></a><span class="w">                </span><span class="p">.</span><span class="na">setGrant</span><span class="p">(</span><span class="s">&quot;identity-net:951002007l78123233&quot;</span><span class="p">)</span><span class="w">  </span><span class="c1">// 授权者，这里是super_admin</span><span class="w"></span>
<a id="__codelineno-4-121" name="__codelineno-4-121" href="#__codelineno-4-121"></a><span class="w">                </span><span class="p">.</span><span class="na">addGranted</span><span class="p">(</span><span class="s">&quot;credence-net:usr-0&quot;</span><span class="p">)</span><span class="w">   </span><span class="c1">// 被授权者 usr-0</span><span class="w"></span>
<a id="__codelineno-4-122" name="__codelineno-4-122" href="#__codelineno-4-122"></a><span class="w">                </span><span class="c1">//此处合约为CredenceTPL，后续部署其他合约需要修改</span><span class="w"></span>
<a id="__codelineno-4-123" name="__codelineno-4-123" href="#__codelineno-4-123"></a><span class="w">                </span><span class="p">.</span><span class="na">addOpId</span><span class="p">(</span><span class="n">DigestUtils</span><span class="p">.</span><span class="na">sha256Hex</span><span class="p">(</span><span class="s">&quot;credence-net:CredenceTPL.deploy&quot;</span><span class="p">))</span><span class="w">  </span>
<a id="__codelineno-4-124" name="__codelineno-4-124" href="#__codelineno-4-124"></a><span class="w">                </span><span class="c1">// 权限让渡，此处代表usr-0可以继续授权给别人</span><span class="w"></span>
<a id="__codelineno-4-125" name="__codelineno-4-125" href="#__codelineno-4-125"></a><span class="w">                </span><span class="p">.</span><span class="na">setIsTransfer</span><span class="p">(</span><span class="n">Peer</span><span class="p">.</span><span class="na">Authorize</span><span class="p">.</span><span class="na">TransferType</span><span class="p">.</span><span class="na">TRANSFER_REPEATEDLY</span><span class="p">)</span><span class="w"> </span>
<a id="__codelineno-4-126" name="__codelineno-4-126" href="#__codelineno-4-126"></a><span class="w">                </span><span class="p">.</span><span class="na">setCreateTime</span><span class="p">(</span><span class="n">Timestamp</span><span class="p">.</span><span class="na">newBuilder</span><span class="p">().</span><span class="na">setSeconds</span><span class="p">(</span><span class="n">millis</span><span class="w"> </span><span class="o">/</span><span class="w"> </span><span class="mi">1000</span><span class="p">).</span><span class="na">setNanos</span><span class="p">((</span><span class="kt">int</span><span class="p">)</span><span class="w"> </span><span class="p">((</span><span class="n">millis</span><span class="w"> </span><span class="o">%</span><span class="w"> </span><span class="mi">1000</span><span class="p">)</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="mi">1000000</span><span class="p">)).</span><span class="na">build</span><span class="p">())</span><span class="w"></span>
<a id="__codelineno-4-127" name="__codelineno-4-127" href="#__codelineno-4-127"></a><span class="w">                </span><span class="p">.</span><span class="na">setAuthorizeValid</span><span class="p">(</span><span class="kc">true</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-128" name="__codelineno-4-128" href="#__codelineno-4-128"></a><span class="w">                </span><span class="p">.</span><span class="na">setVersion</span><span class="p">(</span><span class="s">&quot;1.0&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-129" name="__codelineno-4-129" href="#__codelineno-4-129"></a><span class="w">                </span><span class="p">.</span><span class="na">build</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-4-130" name="__codelineno-4-130" href="#__codelineno-4-130"></a>
<a id="__codelineno-4-131" name="__codelineno-4-131" href="#__codelineno-4-131"></a><span class="w">        </span><span class="n">String</span><span class="w"> </span><span class="n">tranId_3</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">UUID</span><span class="p">.</span><span class="na">randomUUID</span><span class="p">().</span><span class="na">toString</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-4-132" name="__codelineno-4-132" href="#__codelineno-4-132"></a><span class="w">        </span><span class="n">Peer</span><span class="p">.</span><span class="na">Transaction</span><span class="w"> </span><span class="n">tran_3</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">superCreator</span><span class="p">.</span><span class="na">createInvokeTran</span><span class="p">(</span><span class="n">tranId_3</span><span class="p">,</span><span class="w"> </span><span class="n">superCertId</span><span class="p">,</span><span class="w"> </span><span class="n">didChaincodeId</span><span class="p">,</span><span class="w"> </span><span class="n">grantOperate</span><span class="p">,</span><span class="w"></span>
<a id="__codelineno-4-133" name="__codelineno-4-133" href="#__codelineno-4-133"></a><span class="w">                </span><span class="n">JSONObject</span><span class="p">.</span><span class="na">toJSONString</span><span class="p">(</span><span class="n">Collections</span><span class="p">.</span><span class="na">singletonList</span><span class="p">(</span><span class="n">JsonFormat</span><span class="p">.</span><span class="na">printer</span><span class="p">().</span><span class="na">print</span><span class="p">(</span><span class="n">authorize_1</span><span class="p">))),</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;&quot;</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-4-134" name="__codelineno-4-134" href="#__codelineno-4-134"></a><span class="w">        </span><span class="n">postClient</span><span class="p">.</span><span class="na">postSignedTran</span><span class="p">(</span><span class="n">tran_3</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-4-135" name="__codelineno-4-135" href="#__codelineno-4-135"></a><span class="w">        </span><span class="n">TimeUnit</span><span class="p">.</span><span class="na">SECONDS</span><span class="p">.</span><span class="na">sleep</span><span class="p">(</span><span class="mi">5</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-4-136" name="__codelineno-4-136" href="#__codelineno-4-136"></a><span class="w">        </span><span class="n">Peer</span><span class="p">.</span><span class="na">TransactionResult</span><span class="w"> </span><span class="n">tranResult_3</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">infoClient</span><span class="p">.</span><span class="na">getTranResultByTranId</span><span class="p">(</span><span class="n">tranId_3</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-4-137" name="__codelineno-4-137" href="#__codelineno-4-137"></a><span class="w">        </span><span class="n">Peer</span><span class="p">.</span><span class="na">ActionResult</span><span class="w"> </span><span class="n">actionResult_3</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">tranResult_3</span><span class="p">.</span><span class="na">getErr</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-4-138" name="__codelineno-4-138" href="#__codelineno-4-138"></a><span class="w">        </span><span class="n">Assertions</span><span class="p">.</span><span class="na">assertEquals</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="n">actionResult_3</span><span class="p">.</span><span class="na">getCode</span><span class="p">(),</span><span class="w"> </span><span class="s">&quot;没有错误，授权成功&quot;</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-4-139" name="__codelineno-4-139" href="#__codelineno-4-139"></a><span class="w">    </span><span class="p">}</span><span class="w"></span>
<a id="__codelineno-4-140" name="__codelineno-4-140" href="#__codelineno-4-140"></a>
<a id="__codelineno-4-141" name="__codelineno-4-141" href="#__codelineno-4-141"></a><span class="w">    </span><span class="nd">@Test</span><span class="w"></span>
<a id="__codelineno-4-142" name="__codelineno-4-142" href="#__codelineno-4-142"></a><span class="w">    </span><span class="nd">@DisplayName</span><span class="p">(</span><span class="s">&quot;usr-0具有了向业务链部署CredenceTPL的权限，因此向业务链部署合约&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-143" name="__codelineno-4-143" href="#__codelineno-4-143"></a><span class="w">    </span><span class="nd">@Order</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-144" name="__codelineno-4-144" href="#__codelineno-4-144"></a><span class="w">    </span><span class="kt">void</span><span class="w"> </span><span class="nf">testDeployContract</span><span class="p">()</span><span class="w"> </span><span class="kd">throws</span><span class="w"> </span><span class="n">InterruptedException</span><span class="p">,</span><span class="w"> </span><span class="n">IOException</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<a id="__codelineno-4-145" name="__codelineno-4-145" href="#__codelineno-4-145"></a><span class="w">        </span><span class="c1">// 向业务链提交，部署合约</span><span class="w"></span>
<a id="__codelineno-4-146" name="__codelineno-4-146" href="#__codelineno-4-146"></a><span class="w">        </span><span class="n">String</span><span class="w"> </span><span class="n">tplString</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">FileUtils</span><span class="p">.</span><span class="na">readFileToString</span><span class="p">(</span><span class="k">new</span><span class="w"> </span><span class="n">File</span><span class="p">(</span><span class="s">&quot;jks/test/tpl/CredenceTPL.scala&quot;</span><span class="p">),</span><span class="w"> </span><span class="n">StandardCharsets</span><span class="p">.</span><span class="na">UTF_8</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-4-147" name="__codelineno-4-147" href="#__codelineno-4-147"></a><span class="w">        </span><span class="n">Peer</span><span class="p">.</span><span class="na">ChaincodeDeploy</span><span class="w"> </span><span class="n">chaincodeDeploy</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Peer</span><span class="p">.</span><span class="na">ChaincodeDeploy</span><span class="p">.</span><span class="na">newBuilder</span><span class="p">()</span><span class="w"></span>
<a id="__codelineno-4-148" name="__codelineno-4-148" href="#__codelineno-4-148"></a><span class="w">                </span><span class="p">.</span><span class="na">setTimeout</span><span class="p">(</span><span class="mi">5000</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-149" name="__codelineno-4-149" href="#__codelineno-4-149"></a><span class="w">                </span><span class="p">.</span><span class="na">setCodePackage</span><span class="p">(</span><span class="n">tplString</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-150" name="__codelineno-4-150" href="#__codelineno-4-150"></a><span class="w">                </span><span class="p">.</span><span class="na">setLegalProse</span><span class="p">(</span><span class="s">&quot;&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-151" name="__codelineno-4-151" href="#__codelineno-4-151"></a><span class="w">                </span><span class="p">.</span><span class="na">setCType</span><span class="p">(</span><span class="n">Peer</span><span class="p">.</span><span class="na">ChaincodeDeploy</span><span class="p">.</span><span class="na">CodeType</span><span class="p">.</span><span class="na">CODE_SCALA</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-152" name="__codelineno-4-152" href="#__codelineno-4-152"></a><span class="w">                </span><span class="p">.</span><span class="na">setRType</span><span class="p">(</span><span class="n">Peer</span><span class="p">.</span><span class="na">ChaincodeDeploy</span><span class="p">.</span><span class="na">RunType</span><span class="p">.</span><span class="na">RUN_SERIAL</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-153" name="__codelineno-4-153" href="#__codelineno-4-153"></a><span class="w">                </span><span class="p">.</span><span class="na">setSType</span><span class="p">(</span><span class="n">Peer</span><span class="p">.</span><span class="na">ChaincodeDeploy</span><span class="p">.</span><span class="na">StateType</span><span class="p">.</span><span class="na">STATE_BLOCK</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-154" name="__codelineno-4-154" href="#__codelineno-4-154"></a><span class="w">                </span><span class="p">.</span><span class="na">setInitParameter</span><span class="p">(</span><span class="s">&quot;&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-155" name="__codelineno-4-155" href="#__codelineno-4-155"></a><span class="w">                </span><span class="p">.</span><span class="na">setCclassification</span><span class="p">(</span><span class="n">Peer</span><span class="p">.</span><span class="na">ChaincodeDeploy</span><span class="p">.</span><span class="na">ContractClassification</span><span class="p">.</span><span class="na">CONTRACT_CUSTOM</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-156" name="__codelineno-4-156" href="#__codelineno-4-156"></a><span class="w">                </span><span class="p">.</span><span class="na">build</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-4-157" name="__codelineno-4-157" href="#__codelineno-4-157"></a><span class="w">        </span><span class="n">DeployTran</span><span class="w"> </span><span class="n">deployTran</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">DeployTran</span><span class="p">.</span><span class="na">newBuilder</span><span class="p">()</span><span class="w"></span>
<a id="__codelineno-4-158" name="__codelineno-4-158" href="#__codelineno-4-158"></a><span class="w">                </span><span class="p">.</span><span class="na">setTxid</span><span class="p">(</span><span class="n">UUID</span><span class="p">.</span><span class="na">randomUUID</span><span class="p">().</span><span class="na">toString</span><span class="p">())</span><span class="w"></span>
<a id="__codelineno-4-159" name="__codelineno-4-159" href="#__codelineno-4-159"></a><span class="w">                </span><span class="p">.</span><span class="na">setCertId</span><span class="p">(</span><span class="n">usr0_certId_0</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-160" name="__codelineno-4-160" href="#__codelineno-4-160"></a><span class="w">                </span><span class="p">.</span><span class="na">setChaincodeIdScredenceTPLId</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-161" name="__codelineno-4-161" href="#__codelineno-4-161"></a><span class="w">                </span><span class="p">.</span><span class="na">setChaincodeDeploy</span><span class="p">(</span><span class="n">chaincodeDeploy</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-162" name="__codelineno-4-162" href="#__codelineno-4-162"></a><span class="w">                </span><span class="p">.</span><span class="na">build</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-4-163" name="__codelineno-4-163" href="#__codelineno-4-163"></a>
<a id="__codelineno-4-164" name="__codelineno-4-164" href="#__codelineno-4-164"></a><span class="w">        </span><span class="c1">// 此步骤中usr0部署合约成功</span><span class="w"></span>
<a id="__codelineno-4-165" name="__codelineno-4-165" href="#__codelineno-4-165"></a><span class="w">        </span><span class="n">DeployTran</span><span class="w"> </span><span class="n">deployTran_1</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">deployTran</span><span class="p">.</span><span class="na">toBuilder</span><span class="p">().</span><span class="na">setTxid</span><span class="p">(</span><span class="n">UUID</span><span class="p">.</span><span class="na">randomUUID</span><span class="p">().</span><span class="na">toString</span><span class="p">()).</span><span class="na">build</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-4-166" name="__codelineno-4-166" href="#__codelineno-4-166"></a><span class="w">        </span><span class="n">Peer</span><span class="p">.</span><span class="na">Transaction</span><span class="w"> </span><span class="n">signedDeployTran_1</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">usr0_tranCreator_0</span><span class="p">.</span><span class="na">createDeployTran</span><span class="p">(</span><span class="n">deployTran_1</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-4-167" name="__codelineno-4-167" href="#__codelineno-4-167"></a><span class="w">        </span><span class="n">postCredenceClient</span><span class="p">.</span><span class="na">postSignedTran</span><span class="p">(</span><span class="n">signedDeployTran_1</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-4-168" name="__codelineno-4-168" href="#__codelineno-4-168"></a><span class="w">        </span><span class="n">TimeUnit</span><span class="p">.</span><span class="na">SECONDS</span><span class="p">.</span><span class="na">sleep</span><span class="p">(</span><span class="mi">5</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-4-169" name="__codelineno-4-169" href="#__codelineno-4-169"></a><span class="w">        </span><span class="n">Peer</span><span class="p">.</span><span class="na">TransactionResult</span><span class="w"> </span><span class="n">tranResult_4</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">infoCredenceClient</span><span class="p">.</span><span class="na">getTranResultByTranId</span><span class="p">(</span><span class="n">signedDeployTran_1</span><span class="p">.</span><span class="na">getId</span><span class="p">());</span><span class="w"></span>
<a id="__codelineno-4-170" name="__codelineno-4-170" href="#__codelineno-4-170"></a><span class="w">        </span><span class="n">Peer</span><span class="p">.</span><span class="na">ActionResult</span><span class="w"> </span><span class="n">actionResult_4</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">tranResult_4</span><span class="p">.</span><span class="na">getErr</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-4-171" name="__codelineno-4-171" href="#__codelineno-4-171"></a><span class="w">        </span><span class="n">Assertions</span><span class="p">.</span><span class="na">assertEquals</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="n">actionResult_4</span><span class="p">.</span><span class="na">getCode</span><span class="p">(),</span><span class="w"> </span><span class="s">&quot;没有错误，合约部署成功&quot;</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-4-172" name="__codelineno-4-172" href="#__codelineno-4-172"></a><span class="w">    </span><span class="p">}</span><span class="w"></span>
<a id="__codelineno-4-173" name="__codelineno-4-173" href="#__codelineno-4-173"></a>
<a id="__codelineno-4-174" name="__codelineno-4-174" href="#__codelineno-4-174"></a><span class="w">    </span><span class="nd">@Test</span><span class="w"></span>
<a id="__codelineno-4-175" name="__codelineno-4-175" href="#__codelineno-4-175"></a><span class="w">    </span><span class="nd">@DisplayName</span><span class="p">(</span><span class="s">&quot;usr-0，作为合约部署者，注册合约里的Operate-注册合约的某个方法&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-176" name="__codelineno-4-176" href="#__codelineno-4-176"></a><span class="w">    </span><span class="nd">@Order</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-177" name="__codelineno-4-177" href="#__codelineno-4-177"></a><span class="w">    </span><span class="kt">void</span><span class="w"> </span><span class="nf">testSignUpOperate_1</span><span class="p">()</span><span class="w"> </span><span class="kd">throws</span><span class="w"> </span><span class="n">InterruptedException</span><span class="p">,</span><span class="w"> </span><span class="n">InvalidProtocolBufferException</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<a id="__codelineno-4-178" name="__codelineno-4-178" href="#__codelineno-4-178"></a>
<a id="__codelineno-4-179" name="__codelineno-4-179" href="#__codelineno-4-179"></a><span class="w">        </span><span class="c1">// usr0注册合约的某个方法的Operate成功，向身份链提交</span><span class="w"></span>
<a id="__codelineno-4-180" name="__codelineno-4-180" href="#__codelineno-4-180"></a><span class="w">         </span><span class="c1">//若为身份链管理账户、证书，业务链管理操作权限并负责业务的多链模型，则向&lt;业务链&gt;提交，将该段代码中的身份链前缀&quot;identity-net&quot;改为业务链前缀“credence-net”</span><span class="w"></span>
<a id="__codelineno-4-181" name="__codelineno-4-181" href="#__codelineno-4-181"></a><span class="w">        </span><span class="c1">//将提交至&lt;身份链&gt;“postClient”的交易改为“提交至&lt;业务链&gt;“postCredenceClient”</span><span class="w"></span>
<a id="__codelineno-4-182" name="__codelineno-4-182" href="#__codelineno-4-182"></a><span class="w">        </span><span class="kt">long</span><span class="w"> </span><span class="n">millis</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">System</span><span class="p">.</span><span class="na">currentTimeMillis</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-4-183" name="__codelineno-4-183" href="#__codelineno-4-183"></a><span class="w">        </span><span class="n">Peer</span><span class="p">.</span><span class="na">Operate</span><span class="w"> </span><span class="n">operate</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Peer</span><span class="p">.</span><span class="na">Operate</span><span class="p">.</span><span class="na">newBuilder</span><span class="p">()</span><span class="w"></span>
<a id="__codelineno-4-184" name="__codelineno-4-184" href="#__codelineno-4-184"></a><span class="w">                </span><span class="c1">// 合约的某个方法</span><span class="w"></span>
<a id="__codelineno-4-185" name="__codelineno-4-185" href="#__codelineno-4-185"></a><span class="w">                </span><span class="p">.</span><span class="na">setOpId</span><span class="p">(</span><span class="n">DigestUtils</span><span class="p">.</span><span class="na">sha256Hex</span><span class="p">(</span><span class="s">&quot;credence-net:CredenceTPL.creProof3&quot;</span><span class="p">))</span><span class="w"></span>
<a id="__codelineno-4-186" name="__codelineno-4-186" href="#__codelineno-4-186"></a><span class="w">                </span><span class="c1">// 描述随意</span><span class="w"></span>
<a id="__codelineno-4-187" name="__codelineno-4-187" href="#__codelineno-4-187"></a><span class="w">                </span><span class="p">.</span><span class="na">setDescription</span><span class="p">(</span><span class="s">&quot;CredenceTPL.creProof3&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-188" name="__codelineno-4-188" href="#__codelineno-4-188"></a><span class="w">                </span><span class="p">.</span><span class="na">setRegister</span><span class="p">(</span><span class="s">&quot;credence-net:usr-0&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-189" name="__codelineno-4-189" href="#__codelineno-4-189"></a><span class="w">                </span><span class="c1">// setIsPublish设置方法是否公开，比如新注册了一个用户usr-1，如果是false的话，usr-1需要被授权才能调用creProof3</span><span class="w"></span>
<a id="__codelineno-4-190" name="__codelineno-4-190" href="#__codelineno-4-190"></a><span class="w">                </span><span class="c1">// 如果设置true，新注册的任何用户，都可以调用这个方法</span><span class="w"></span>
<a id="__codelineno-4-191" name="__codelineno-4-191" href="#__codelineno-4-191"></a><span class="w">                </span><span class="c1">//也即，false则别的用户需要得到授权才可以调用，true则表示公开，任何人(注册用户)都可以调用</span><span class="w"></span>
<a id="__codelineno-4-192" name="__codelineno-4-192" href="#__codelineno-4-192"></a><span class="w">                </span><span class="p">.</span><span class="na">setIsPublish</span><span class="p">(</span><span class="kc">true</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-193" name="__codelineno-4-193" href="#__codelineno-4-193"></a><span class="w">                </span><span class="p">.</span><span class="na">setOperateType</span><span class="p">(</span><span class="n">Peer</span><span class="p">.</span><span class="na">Operate</span><span class="p">.</span><span class="na">OperateType</span><span class="p">.</span><span class="na">OPERATE_CONTRACT</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-194" name="__codelineno-4-194" href="#__codelineno-4-194"></a><span class="w">                </span><span class="p">.</span><span class="na">setAuthFullName</span><span class="p">(</span><span class="s">&quot;credence-net:CredenceTPL.creProof3&quot;</span><span class="p">)</span><span class="w"> </span><span class="c1">// 假设CredenceTPL 有多个版本</span><span class="w"></span>
<a id="__codelineno-4-195" name="__codelineno-4-195" href="#__codelineno-4-195"></a><span class="w">                </span><span class="p">.</span><span class="na">setCreateTime</span><span class="p">(</span><span class="n">Timestamp</span><span class="p">.</span><span class="na">newBuilder</span><span class="p">().</span><span class="na">setSeconds</span><span class="p">(</span><span class="n">millis</span><span class="w"> </span><span class="o">/</span><span class="w"> </span><span class="mi">1000</span><span class="p">).</span><span class="na">setNanos</span><span class="p">((</span><span class="kt">int</span><span class="p">)</span><span class="w"> </span><span class="p">((</span><span class="n">millis</span><span class="w"> </span><span class="o">%</span><span class="w"> </span><span class="mi">1000</span><span class="p">)</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="mi">1000000</span><span class="p">)).</span><span class="na">build</span><span class="p">())</span><span class="w"></span>
<a id="__codelineno-4-196" name="__codelineno-4-196" href="#__codelineno-4-196"></a><span class="w">                </span><span class="p">.</span><span class="na">setOpValid</span><span class="p">(</span><span class="kc">true</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-197" name="__codelineno-4-197" href="#__codelineno-4-197"></a><span class="w">                </span><span class="p">.</span><span class="na">setVersion</span><span class="p">(</span><span class="s">&quot;1.0&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-198" name="__codelineno-4-198" href="#__codelineno-4-198"></a><span class="w">                </span><span class="p">.</span><span class="na">build</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-4-199" name="__codelineno-4-199" href="#__codelineno-4-199"></a><span class="w">        </span><span class="n">String</span><span class="w"> </span><span class="n">tranId</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">UUID</span><span class="p">.</span><span class="na">randomUUID</span><span class="p">().</span><span class="na">toString</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-4-200" name="__codelineno-4-200" href="#__codelineno-4-200"></a><span class="w">        </span><span class="n">Peer</span><span class="p">.</span><span class="na">Transaction</span><span class="w"> </span><span class="n">tran</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">usr0_tranCreator_0</span><span class="p">.</span><span class="na">createInvokeTran</span><span class="p">(</span><span class="n">tranId</span><span class="p">,</span><span class="w"> </span><span class="n">usr0_certId_0</span><span class="p">,</span><span class="w"> </span><span class="n">didChaincodeId</span><span class="p">,</span><span class="w"> </span><span class="n">signUpOperate</span><span class="p">,</span><span class="w"> </span><span class="n">JsonFormat</span><span class="p">.</span><span class="na">printer</span><span class="p">().</span><span class="na">print</span><span class="p">(</span><span class="n">operate</span><span class="p">),</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;&quot;</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-4-201" name="__codelineno-4-201" href="#__codelineno-4-201"></a><span class="w">        </span><span class="c1">// 向身份链提交</span><span class="w"></span>
<a id="__codelineno-4-202" name="__codelineno-4-202" href="#__codelineno-4-202"></a><span class="w">        </span><span class="n">postClient</span><span class="p">.</span><span class="na">postSignedTran</span><span class="p">(</span><span class="n">tran</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-4-203" name="__codelineno-4-203" href="#__codelineno-4-203"></a><span class="w">        </span><span class="n">TimeUnit</span><span class="p">.</span><span class="na">SECONDS</span><span class="p">.</span><span class="na">sleep</span><span class="p">(</span><span class="mi">5</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-4-204" name="__codelineno-4-204" href="#__codelineno-4-204"></a><span class="w">        </span><span class="n">Peer</span><span class="p">.</span><span class="na">TransactionResult</span><span class="w"> </span><span class="n">tranResult</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">infoClient</span><span class="p">.</span><span class="na">getTranResultByTranId</span><span class="p">(</span><span class="n">tranId</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-4-205" name="__codelineno-4-205" href="#__codelineno-4-205"></a><span class="w">        </span><span class="n">Peer</span><span class="p">.</span><span class="na">ActionResult</span><span class="w"> </span><span class="n">actionResult</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">tranResult</span><span class="p">.</span><span class="na">getErr</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-4-206" name="__codelineno-4-206" href="#__codelineno-4-206"></a><span class="w">        </span><span class="n">Assertions</span><span class="p">.</span><span class="na">assertEquals</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="n">actionResult</span><span class="p">.</span><span class="na">getCode</span><span class="p">(),</span><span class="w"> </span><span class="s">&quot;没有错误，操作注册成功&quot;</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-4-207" name="__codelineno-4-207" href="#__codelineno-4-207"></a><span class="w">    </span><span class="p">}</span><span class="w"></span>
<a id="__codelineno-4-208" name="__codelineno-4-208" href="#__codelineno-4-208"></a>
<a id="__codelineno-4-209" name="__codelineno-4-209" href="#__codelineno-4-209"></a><span class="w">    </span><span class="nd">@Test</span><span class="w"></span>
<a id="__codelineno-4-210" name="__codelineno-4-210" href="#__codelineno-4-210"></a><span class="w">    </span><span class="nd">@DisplayName</span><span class="p">(</span><span class="s">&quot;调用业务链中刚部署的合约，存证数据&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-211" name="__codelineno-4-211" href="#__codelineno-4-211"></a><span class="w">    </span><span class="nd">@Order</span><span class="p">(</span><span class="mi">6</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-4-212" name="__codelineno-4-212" href="#__codelineno-4-212"></a><span class="w">    </span><span class="kt">void</span><span class="w"> </span><span class="nf">testCredenceProof</span><span class="p">()</span><span class="w"> </span><span class="kd">throws</span><span class="w"> </span><span class="n">InterruptedException</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<a id="__codelineno-4-213" name="__codelineno-4-213" href="#__codelineno-4-213"></a><span class="w">        </span><span class="c1">// usr0提交存证交易，向业务链提交</span><span class="w"></span>
<a id="__codelineno-4-214" name="__codelineno-4-214" href="#__codelineno-4-214"></a><span class="w">        </span><span class="n">String</span><span class="w"> </span><span class="n">tranId</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">UUID</span><span class="p">.</span><span class="na">randomUUID</span><span class="p">().</span><span class="na">toString</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-4-215" name="__codelineno-4-215" href="#__codelineno-4-215"></a><span class="w">        </span><span class="n">Peer</span><span class="p">.</span><span class="na">Transaction</span><span class="w"> </span><span class="n">tran</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">usr0_tranCreator_0</span><span class="p">.</span><span class="na">createInvokeTran</span><span class="p">(</span><span class="n">tranId</span><span class="p">,</span><span class="w"> </span><span class="n">usr0_certId_0</span><span class="p">,</span><span class="w"> </span><span class="n">credenceTPLId</span><span class="p">,</span><span class="w"></span>
<a id="__codelineno-4-216" name="__codelineno-4-216" href="#__codelineno-4-216"></a><span class="w">                </span><span class="s">&quot;creProof3&quot;</span><span class="p">,</span><span class="w"> </span><span class="n">String</span><span class="p">.</span><span class="na">format</span><span class="p">(</span><span class="s">&quot;{\&quot;uuid\&quot; : \&quot;%s\&quot;,\&quot;data\&quot; : \&quot;{\\\&quot;data1\\\&quot;: \\\&quot;xyb002\\\&quot;,\\\&quot;data2\\\&quot;: \\\&quot;xyb003\\\&quot;}\&quot;}&quot;</span><span class="p">,</span><span class="w"> </span><span class="n">tranId</span><span class="p">),</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;&quot;</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-4-217" name="__codelineno-4-217" href="#__codelineno-4-217"></a><span class="w">        </span><span class="n">String</span><span class="w"> </span><span class="n">tranHex</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Hex</span><span class="p">.</span><span class="na">encodeHexString</span><span class="p">(</span><span class="n">tran</span><span class="p">.</span><span class="na">toByteArray</span><span class="p">());</span><span class="w"></span>
<a id="__codelineno-4-218" name="__codelineno-4-218" href="#__codelineno-4-218"></a><span class="w">        </span><span class="n">postCredenceClient</span><span class="p">.</span><span class="na">postSignedTran</span><span class="p">(</span><span class="n">tranHex</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-4-219" name="__codelineno-4-219" href="#__codelineno-4-219"></a><span class="w">        </span><span class="n">TimeUnit</span><span class="p">.</span><span class="na">SECONDS</span><span class="p">.</span><span class="na">sleep</span><span class="p">(</span><span class="mi">5</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-4-220" name="__codelineno-4-220" href="#__codelineno-4-220"></a><span class="w">        </span><span class="n">Peer</span><span class="p">.</span><span class="na">TransactionResult</span><span class="w"> </span><span class="n">tranResult</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">infoCredenceClient</span><span class="p">.</span><span class="na">getTranResultByTranId</span><span class="p">(</span><span class="n">tranId</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-4-221" name="__codelineno-4-221" href="#__codelineno-4-221"></a><span class="w">        </span><span class="n">Peer</span><span class="p">.</span><span class="na">ActionResult</span><span class="w"> </span><span class="n">actionResult</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">tranResult</span><span class="p">.</span><span class="na">getErr</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-4-222" name="__codelineno-4-222" href="#__codelineno-4-222"></a><span class="w">        </span><span class="n">Assertions</span><span class="p">.</span><span class="na">assertEquals</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="n">actionResult</span><span class="p">.</span><span class="na">getCode</span><span class="p">(),</span><span class="w"> </span><span class="s">&quot;存证成功&quot;</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-4-223" name="__codelineno-4-223" href="#__codelineno-4-223"></a><span class="w">    </span><span class="p">}</span><span class="w"></span>
<a id="__codelineno-4-224" name="__codelineno-4-224" href="#__codelineno-4-224"></a><span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>使用<a href="https://keystore-explorer.org/">KeyStoreExplorer</a>（或者使用<a href="https://gitee.com/BTAJL/ToolCollection/blob/master/src/main/java/repchain/genjks/GenerateJks.java">代码</a>）即可生成密钥对，导出证书</p>
<h2 id="repchain">RepChain启动方式</h2>
<p>RepChain是运行在JVM上的，因此编译打包RepChain并安装了jdk13后，即可使用如下命令启动RepChain，如果打包时指定了启动主类，可以不使用<code>-cp</code>参数来指定启动主类</p>
<h3 id="_22">单机多节点</h3>
<blockquote>
<p>常用来模拟测试</p>
</blockquote>
<div class="highlight"><pre><span></span><code><a id="__codelineno-5-1" name="__codelineno-5-1" href="#__codelineno-5-1"></a><span class="n">java</span><span class="w"> </span><span class="o">-</span><span class="n">cp</span><span class="w"> </span><span class="n">RepChain</span><span class="p">.</span><span class="na">jar</span><span class="w"> </span><span class="n">rep</span><span class="p">.</span><span class="na">app</span><span class="p">.</span><span class="na">Repchain</span><span class="w"></span>
</code></pre></div>
<h3 id="_23">分布式单机单节点</h3>
<blockquote>
<p>分布式部署单机单节点的时候常用到</p>
</blockquote>
<div class="highlight"><pre><span></span><code><a id="__codelineno-6-1" name="__codelineno-6-1" href="#__codelineno-6-1"></a><span class="c1">// 可以设置多参数，分别为节点名</span><span class="w"></span>
<a id="__codelineno-6-2" name="__codelineno-6-2" href="#__codelineno-6-2"></a><span class="n">java</span><span class="w"> </span><span class="o">-</span><span class="n">cp</span><span class="w"> </span><span class="n">RepChain</span><span class="p">.</span><span class="na">jar</span><span class="w"> </span><span class="n">rep</span><span class="p">.</span><span class="na">app</span><span class="p">.</span><span class="na">Repchain_Single</span><span class="w"> </span><span class="s">&quot;***.nodex&quot;</span><span class="w"></span>
</code></pre></div>
<h3 id="_24">节点管理服务</h3>
<div class="highlight"><pre><span></span><code><a id="__codelineno-7-1" name="__codelineno-7-1" href="#__codelineno-7-1"></a><span class="c1">// 参数都为节点名</span><span class="w"></span>
<a id="__codelineno-7-2" name="__codelineno-7-2" href="#__codelineno-7-2"></a><span class="n">java</span><span class="w"> </span><span class="o">-</span><span class="n">cp</span><span class="w"> </span><span class="n">RepChain</span><span class="p">.</span><span class="na">jar</span><span class="w"> </span><span class="n">rep</span><span class="p">.</span><span class="na">app</span><span class="p">.</span><span class="na">RepChain_Management</span><span class="w"> </span><span class="s">&quot;***.node1&quot;</span><span class="w"> </span><span class="s">&quot;***.node2&quot;</span><span class="w"></span>
<a id="__codelineno-7-3" name="__codelineno-7-3" href="#__codelineno-7-3"></a><span class="c1">// 也可以不加参数</span><span class="w"></span>
<a id="__codelineno-7-4" name="__codelineno-7-4" href="#__codelineno-7-4"></a><span class="n">java</span><span class="w"> </span><span class="o">-</span><span class="n">cp</span><span class="w"> </span><span class="n">RepChain</span><span class="p">.</span><span class="na">jar</span><span class="w"> </span><span class="n">rep</span><span class="p">.</span><span class="na">app</span><span class="p">.</span><span class="na">RepChain_Management</span><span class="w"></span>
</code></pre></div>
<h2 id="repchainmanagement">RepChainManagement</h2>
<p>RepChainManagement为RepChain的<strong>扩展服务</strong>，是用来管理RepChain节点启停的服务，该服务提供了管理节点的API接口，如：上传节点配置文件、启动或停止节点的命令以及查询节点的状态，接口描述文档如下图Swagger-UI所示（默认为：<a href="http://localhost:7081/swagger/index.html">http://localhost:7081/swagger/index.html</a>）</p>
<p><img alt="RepChainManagement-swagger" src="../img/RepChainManagement-swagger.png" /></p>
<h3 id="_25">配置说明</h3>
<p>为了适应配置类读取框架，management的配置文件看起来和节点的配置文件几乎一样，<strong>但是用到的配置项只是其中的若干</strong>，配置文件为conf/management/system.conf，其中用到的配置项有如下：</p>
<p>1.API服务相关配置</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-8-1" name="__codelineno-8-1" href="#__codelineno-8-1"></a><span class="c1">#api是否开启</span><span class="w"></span>
<a id="__codelineno-8-2" name="__codelineno-8-2" href="#__codelineno-8-2"></a><span class="l l-Scalar l-Scalar-Plain">api{</span><span class="w"></span>
<a id="__codelineno-8-3" name="__codelineno-8-3" href="#__codelineno-8-3"></a><span class="w">  </span><span class="l l-Scalar l-Scalar-Plain">http_mode = 0</span><span class="w"> </span><span class="c1">#http协议模式 0:http; 1:https 默认使用http</span><span class="w"></span>
<a id="__codelineno-8-4" name="__codelineno-8-4" href="#__codelineno-8-4"></a><span class="w">  </span><span class="l l-Scalar l-Scalar-Plain">is_need_client_auth = 0</span><span class="w"> </span><span class="c1">#当http的模式设置为https时有效，该配置指https时是否需要客户端验证;0=不验证；1=验证</span><span class="w"></span>
<a id="__codelineno-8-5" name="__codelineno-8-5" href="#__codelineno-8-5"></a><span class="w">  </span><span class="l l-Scalar l-Scalar-Plain">http_service_port = 7081#http服务的端口号，默认为7081</span><span class="w"></span>
<a id="__codelineno-8-6" name="__codelineno-8-6" href="#__codelineno-8-6"></a><span class="l l-Scalar l-Scalar-Plain">}</span><span class="w"></span>
</code></pre></div>
<p>2.如果开启https的话，这里配置https相关密钥库</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-9-1" name="__codelineno-9-1" href="#__codelineno-9-1"></a><span class="l l-Scalar l-Scalar-Plain">remote {</span><span class="w"></span>
<a id="__codelineno-9-2" name="__codelineno-9-2" href="#__codelineno-9-2"></a><span class="w">  </span><span class="l l-Scalar l-Scalar-Plain">#artery模式下的配置</span><span class="w"></span>
<a id="__codelineno-9-3" name="__codelineno-9-3" href="#__codelineno-9-3"></a><span class="w">  </span><span class="l l-Scalar l-Scalar-Plain">artery {</span><span class="w"></span>
<a id="__codelineno-9-4" name="__codelineno-9-4" href="#__codelineno-9-4"></a><span class="w">    </span><span class="l l-Scalar l-Scalar-Plain">ssl {</span><span class="w"></span>
<a id="__codelineno-9-5" name="__codelineno-9-5" href="#__codelineno-9-5"></a><span class="w">      </span><span class="l l-Scalar l-Scalar-Plain">#节点的ssl配置,主要设置密码，密钥、证书、信任证书路径在程序中动态设置</span><span class="w"></span>
<a id="__codelineno-9-6" name="__codelineno-9-6" href="#__codelineno-9-6"></a><span class="w">      </span><span class="l l-Scalar l-Scalar-Plain">config-ssl-engine {</span><span class="w"></span>
<a id="__codelineno-9-7" name="__codelineno-9-7" href="#__codelineno-9-7"></a><span class="w">        </span><span class="l l-Scalar l-Scalar-Plain">key-password = &quot;123&quot;</span><span class="w"></span>
<a id="__codelineno-9-8" name="__codelineno-9-8" href="#__codelineno-9-8"></a><span class="w">        </span><span class="l l-Scalar l-Scalar-Plain">key-store-password = &quot;123&quot;</span><span class="w"></span>
<a id="__codelineno-9-9" name="__codelineno-9-9" href="#__codelineno-9-9"></a><span class="w">        </span><span class="l l-Scalar l-Scalar-Plain">trust-store-password = &quot;changeme&quot;</span><span class="w"></span>
<a id="__codelineno-9-10" name="__codelineno-9-10" href="#__codelineno-9-10"></a><span class="w">      </span><span class="l l-Scalar l-Scalar-Plain">}</span><span class="w"></span>
<a id="__codelineno-9-11" name="__codelineno-9-11" href="#__codelineno-9-11"></a><span class="w">    </span><span class="l l-Scalar l-Scalar-Plain">}</span><span class="w"></span>
<a id="__codelineno-9-12" name="__codelineno-9-12" href="#__codelineno-9-12"></a><span class="w">  </span><span class="l l-Scalar l-Scalar-Plain">}</span><span class="w"></span>
<a id="__codelineno-9-13" name="__codelineno-9-13" href="#__codelineno-9-13"></a><span class="l l-Scalar l-Scalar-Plain">}</span><span class="w"></span>
</code></pre></div>
<p>3.是否使用国密https(暂时未开源)</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-10-1" name="__codelineno-10-1" href="#__codelineno-10-1"></a><span class="l l-Scalar l-Scalar-Plain">gm {</span><span class="w"></span>
<a id="__codelineno-10-2" name="__codelineno-10-2" href="#__codelineno-10-2"></a><span class="w">  </span><span class="l l-Scalar l-Scalar-Plain">#是否使用国密算法，默认为false，使用java国际标准密码体系；true使用中国国家密码算法</span><span class="w"></span>
<a id="__codelineno-10-3" name="__codelineno-10-3" href="#__codelineno-10-3"></a><span class="w">  </span><span class="l l-Scalar l-Scalar-Plain">is_use_gm = false</span><span class="w"></span>
<a id="__codelineno-10-4" name="__codelineno-10-4" href="#__codelineno-10-4"></a><span class="w">  </span><span class="l l-Scalar l-Scalar-Plain">#jce密码算法提供者的类名</span><span class="w"></span>
<a id="__codelineno-10-5" name="__codelineno-10-5" href="#__codelineno-10-5"></a><span class="w">  </span><span class="l l-Scalar l-Scalar-Plain">gm_jce_provider = &quot;org.bouncycastle.jce.provider.BouncyCastleProvider&quot;</span><span class="w"></span>
<a id="__codelineno-10-6" name="__codelineno-10-6" href="#__codelineno-10-6"></a><span class="w">  </span><span class="l l-Scalar l-Scalar-Plain">#密码算法提供者注册时的注册名称</span><span class="w"></span>
<a id="__codelineno-10-7" name="__codelineno-10-7" href="#__codelineno-10-7"></a><span class="w">  </span><span class="l l-Scalar l-Scalar-Plain">gm_jce_provider_name = &quot;BC&quot;</span><span class="w"></span>
<a id="__codelineno-10-8" name="__codelineno-10-8" href="#__codelineno-10-8"></a><span class="w">  </span><span class="l l-Scalar l-Scalar-Plain">gm_jsse_provider = &quot;org.bouncycastle.jsse.provider.BouncyCastleJsseProvider&quot;</span><span class="w"></span>
<a id="__codelineno-10-9" name="__codelineno-10-9" href="#__codelineno-10-9"></a><span class="w">  </span><span class="l l-Scalar l-Scalar-Plain">gm_jsse_provider_name = &quot;BCJSSE&quot;</span><span class="w"></span>
<a id="__codelineno-10-10" name="__codelineno-10-10" href="#__codelineno-10-10"></a><span class="w">  </span><span class="l l-Scalar l-Scalar-Plain">gm_pfx_sign_key_name = &quot;Sig&quot;</span><span class="w"></span>
<a id="__codelineno-10-11" name="__codelineno-10-11" href="#__codelineno-10-11"></a><span class="l l-Scalar l-Scalar-Plain">}</span><span class="w"></span>
</code></pre></div>
<h3 id="_26">使用说明</h3>
<p>本小节主要介绍如何使用节点管理服务来管理节点，最常使用的三个接口是SystemStartUp、SystemStatus、SystemStop</p>
<p>1.SystemStartUp</p>
<blockquote>
<p>启动节点（<strong>前提是节点的配置都已经通过API或者手动上传成功</strong>）</p>
</blockquote>
<table>
<thead>
<tr>
<th>url</th>
<th>http://ip:port/management/system/SystemStartup/${nodeName}</th>
</tr>
</thead>
<tbody>
<tr>
<td>method</td>
<td>get</td>
</tr>
<tr>
<td>path parameter</td>
<td>nodeName（节点名）</td>
</tr>
</tbody>
</table>
<p>2.SystemStatus</p>
<blockquote>
<p>查看节点状态，可用来查看节点是否启动成功或是否关停成功</p>
</blockquote>
<table>
<thead>
<tr>
<th>url</th>
<th>http://ip:port/management/system/SystemStatus/${nodeName}</th>
</tr>
</thead>
<tbody>
<tr>
<td>method</td>
<td>get</td>
</tr>
<tr>
<td>path parameter</td>
<td>nodeName（节点名）</td>
</tr>
</tbody>
</table>
<p>3.SystemStop</p>
<blockquote>
<p>关停节点</p>
</blockquote>
<table>
<thead>
<tr>
<th>url</th>
<th>http://ip:port/management/system/SystemStop/${nodeName}</th>
</tr>
</thead>
<tbody>
<tr>
<td>method</td>
<td>get</td>
</tr>
<tr>
<td>path parameter</td>
<td>nodeName（节点名）</td>
</tr>
</tbody>
</table>
<p>使用RepChainManagement能成功启动一个节点的前提是：在部署RepChainManagement服务的目录下有对应节点的配置文件、jks文件等节点运行相关文件，因此可以通过两种方式来上传对应的配置文件</p>
<p>1.通过RepChainManagement的API接口上传</p>
<table>
<thead>
<tr>
<th>url</th>
<th>http://ip:port/management/system/postConfigFile</th>
</tr>
</thead>
<tbody>
<tr>
<td>method</td>
<td>post</td>
</tr>
<tr>
<td>Content-Type</td>
<td>multipart/form-data</td>
</tr>
<tr>
<td>request-body</td>
<td>4个参数(分别为String, String, String, Binary类型)：<br>node_name<br>file_type<br>network_name<br>upload_file</td>
</tr>
</tbody>
</table>
<p>request-body：</p>
<table>
<thead>
<tr>
<th>node_name</th>
<th>节点名字，如：121000005l35120456.node1</th>
</tr>
</thead>
<tbody>
<tr>
<td>file_type</td>
<td>pfx_key<br>jks_key<br>pfx_cert<br>jks_key<br>config<br>pfx_trust<br>jks_trust<br>genesis</td>
</tr>
<tr>
<td>network_name</td>
<td>网络名，如：identity-net、credence-net</td>
</tr>
<tr>
<td>upload_file</td>
<td>具体的文件：如：121000005l35120456.node1.jks、genesis.json</td>
</tr>
</tbody>
</table>
<p>file_type：</p>
<table>
<thead>
<tr>
<th>pfx_key</th>
<th>国密的节点私钥（国密组网时使用），如：pfx/identity-net/215159697776981712.node1.pfx</th>
</tr>
</thead>
<tbody>
<tr>
<td>jks_key</td>
<td>节点私钥，如：121000005l35120456.node1.jks</td>
</tr>
<tr>
<td>config</td>
<td>节点的配置文件，如：conf/identity-net/121000005l35120456.node1/system.conf</td>
</tr>
<tr>
<td>pfx_trust</td>
<td>节点的国密的信任列表（国密组网时使用），如：pfx/identity-net/mytruststore.pfx</td>
</tr>
<tr>
<td>jks_trust</td>
<td>节点的信任列表，如：jks/identity-net/mytruststore.jks</td>
</tr>
<tr>
<td>genesis</td>
<td>创世快配置文件（新组建网络），如：json/identity-net/genesis.json</td>
</tr>
</tbody>
</table>
<p>2.手动上传</p>
<p>将所需文件配置到management服务的目录下，可参考RepChain项目的目录配置</p>
<p>成功将启动节点所需文件都上传到对应目录后，就可以通过接口<a href="http://ip:port/management/system/SystemStartup/${nodeName}">http://ip:port/management/system/SystemStartup/${nodeName}</a>来启动节点了，启动之后记得查询节点状态，可以从对应的实时图或者接口确认是否启动成功(<u>请参考下一章节</u>)</p>
<h2 id="_27">动态管理组网节点</h2>
<h3 id="_28">管理方案</h3>
<p>RepChain默认是基于TLSv1.2组网的，因此节点是否拥有可加入网络的权限，是受网络中其他各个节点所维护的信任列表来控制的</p>
<ul>
<li>
<p><strong>在RepChain2.0.0之前的版本</strong>，RepChain的各个节点默认使用<code>mytruststore.jks</code>来保存信任证书列表（包含参与组网的所有节点证书），如果想要加入新的组网节点，有两种方案：</p>
<ul>
<li>
<p>方案一：将网络里现有的所有节点的<code>mytruststore.jks</code>都更新（将新的节点的证书加到该存储库），然后重启所有节点</p>
</li>
<li>
<p>方案二：在<code>mytruststore.jks</code>中预置多一些节点证书，这样无需重启网络，但是也无法预估预置多少合适</p>
</li>
</ul>
</li>
</ul>
<p>​       从上面两个方案可以看出，方式二比方式一稍微好一些，但也不是一劳永逸</p>
<ul>
<li>
<p><strong>RepChain2.0.0及之后</strong>，RepChain的各个节点首次组建网络时，使用<code>mytruststore.jks</code>来保存信任证书列表（包含参与组网的所有节点证书的集合），在组建网络成功之后，各节点会将信任证书列表写到leveldb中。之后，不论重启网络还是新增或删除节点后，再建立TLSv1.2连接时，仍读取保存在leveldb中的信任证书列表，因此，2.0.0版本实现了通过合约来管理（新增或删除）存放在leveldb中的组网节点的信任证书列表。如果想引入新节点到现有网络，需由具有权限的用户先调用对应的节点管理合约来更新信任证书列表。</p>
<ul>
<li>对链上的信任证书列表增加新的节点证书，之后加入新的节点到现有网络时，网络里的所有节点会重构TrustKeyStore，新的节点就可以成功的与其他节点建立TLS连接</li>
</ul>
<blockquote>
<p>测试用例：<a href="https://gitee.com/BTAJL/RCJava-core/blob/master/src/test/java/com/rcjava/multi_chain/ManageNodeCertTest.java#L183">https://gitee.com/BTAJL/RCJava-core/blob/master/src/test/java/com/rcjava/multi_chain/ManageNodeCertTest.java#L183</a></p>
</blockquote>
<ul>
<li>对链上的信任证书列表删除某个节点证书，网络里的所有节点会重构TrustKeyStore，节点down掉之后，就再也加入不到网络里了</li>
</ul>
<blockquote>
<p>测试用例：<a href="https://gitee.com/BTAJL/RCJava-core/blob/master/src/test/java/com/rcjava/multi_chain/ManageNodeCertTest.java#L162">https://gitee.com/BTAJL/RCJava-core/blob/master/src/test/java/com/rcjava/multi_chain/ManageNodeCertTest.java#L162</a></p>
</blockquote>
</li>
</ul>
<h3 id="_29">使用流程</h3>
<p>下面对在RepChain2.0.0动态管理（加入或退出）组网节点做介绍（可参考rcjava-core中的测试用例），使用合约的详细步骤如下：</p>
<blockquote>
<p>注：目前节点管理合约并未内置到创世块中，因此需要先部署合约</p>
</blockquote>
<p>1.首先明确，要管理的网络是哪个网络</p>
<p>假设要管理的是credence-net</p>
<p>2.获得可以部署管理合约（ManageNodeCert）到该网络的权限</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-11-1" name="__codelineno-11-1" href="#__codelineno-11-1"></a><span class="nd">@Test</span><span class="w"></span>
<a id="__codelineno-11-2" name="__codelineno-11-2" href="#__codelineno-11-2"></a><span class="nd">@DisplayName</span><span class="p">(</span><span class="s">&quot;superAdmin注册Operate-可以部署合约credence-net:*.deploy的操作&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-11-3" name="__codelineno-11-3" href="#__codelineno-11-3"></a><span class="nd">@Order</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-11-4" name="__codelineno-11-4" href="#__codelineno-11-4"></a><span class="kt">void</span><span class="w"> </span><span class="nf">signUpOperate</span><span class="p">()</span><span class="w"> </span><span class="kd">throws</span><span class="w"> </span><span class="n">InterruptedException</span><span class="p">,</span><span class="w"> </span><span class="n">IOException</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<a id="__codelineno-11-5" name="__codelineno-11-5" href="#__codelineno-11-5"></a>
<a id="__codelineno-11-6" name="__codelineno-11-6" href="#__codelineno-11-6"></a><span class="w">    </span><span class="c1">// superAdmin注册部署合约credence-net:ManageNodeCert.deploy的操作，向&lt;身份链&gt;提交</span><span class="w"></span>
<a id="__codelineno-11-7" name="__codelineno-11-7" href="#__codelineno-11-7"></a><span class="w">    </span><span class="kt">long</span><span class="w"> </span><span class="n">millis_1</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">System</span><span class="p">.</span><span class="na">currentTimeMillis</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-11-8" name="__codelineno-11-8" href="#__codelineno-11-8"></a><span class="w">    </span><span class="n">Peer</span><span class="p">.</span><span class="na">Operate</span><span class="w"> </span><span class="n">operate</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Peer</span><span class="p">.</span><span class="na">Operate</span><span class="p">.</span><span class="na">newBuilder</span><span class="p">()</span><span class="w"></span>
<a id="__codelineno-11-9" name="__codelineno-11-9" href="#__codelineno-11-9"></a><span class="w">            </span><span class="c1">// 也可以是credence-net:ManageNodeCert.deploy</span><span class="w"></span>
<a id="__codelineno-11-10" name="__codelineno-11-10" href="#__codelineno-11-10"></a><span class="w">            </span><span class="p">.</span><span class="na">setOpId</span><span class="p">(</span><span class="n">DigestUtils</span><span class="p">.</span><span class="na">sha256Hex</span><span class="p">(</span><span class="s">&quot;credence-net:*.deploy&quot;</span><span class="p">))</span><span class="w"></span>
<a id="__codelineno-11-11" name="__codelineno-11-11" href="#__codelineno-11-11"></a><span class="w">            </span><span class="p">.</span><span class="na">setDescription</span><span class="p">(</span><span class="s">&quot;部署存证合约-任意合约的权限&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-11-12" name="__codelineno-11-12" href="#__codelineno-11-12"></a><span class="w">            </span><span class="p">.</span><span class="na">setRegister</span><span class="p">(</span><span class="s">&quot;identity-net:951002007l78123233&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-11-13" name="__codelineno-11-13" href="#__codelineno-11-13"></a><span class="w">            </span><span class="p">.</span><span class="na">setIsPublish</span><span class="p">(</span><span class="kc">false</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-11-14" name="__codelineno-11-14" href="#__codelineno-11-14"></a><span class="w">            </span><span class="p">.</span><span class="na">setOperateType</span><span class="p">(</span><span class="n">Peer</span><span class="p">.</span><span class="na">Operate</span><span class="p">.</span><span class="na">OperateType</span><span class="p">.</span><span class="na">OPERATE_CONTRACT</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-11-15" name="__codelineno-11-15" href="#__codelineno-11-15"></a><span class="w">            </span><span class="p">.</span><span class="na">setAuthFullName</span><span class="p">(</span><span class="s">&quot;credence-net:*.deploy&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-11-16" name="__codelineno-11-16" href="#__codelineno-11-16"></a><span class="w">            </span><span class="p">.</span><span class="na">setCreateTime</span><span class="p">(</span><span class="n">Timestamp</span><span class="p">.</span><span class="na">newBuilder</span><span class="p">().</span><span class="na">setSeconds</span><span class="p">(</span><span class="n">millis_1</span><span class="w"> </span><span class="o">/</span><span class="w"> </span><span class="mi">1000</span><span class="p">).</span><span class="na">setNanos</span><span class="p">((</span><span class="kt">int</span><span class="p">)</span><span class="w"> </span><span class="p">((</span><span class="n">millis_1</span><span class="w"> </span><span class="o">%</span><span class="w"> </span><span class="mi">1000</span><span class="p">)</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="mi">1000000</span><span class="p">)).</span><span class="na">build</span><span class="p">())</span><span class="w"></span>
<a id="__codelineno-11-17" name="__codelineno-11-17" href="#__codelineno-11-17"></a><span class="w">            </span><span class="p">.</span><span class="na">setOpValid</span><span class="p">(</span><span class="kc">true</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-11-18" name="__codelineno-11-18" href="#__codelineno-11-18"></a><span class="w">            </span><span class="p">.</span><span class="na">setVersion</span><span class="p">(</span><span class="s">&quot;1.0&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-11-19" name="__codelineno-11-19" href="#__codelineno-11-19"></a><span class="w">            </span><span class="p">.</span><span class="na">build</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-11-20" name="__codelineno-11-20" href="#__codelineno-11-20"></a><span class="w">    </span><span class="n">String</span><span class="w"> </span><span class="n">tranId_2</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">UUID</span><span class="p">.</span><span class="na">randomUUID</span><span class="p">().</span><span class="na">toString</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-11-21" name="__codelineno-11-21" href="#__codelineno-11-21"></a><span class="w">    </span><span class="c1">// 调用身份管理合约</span><span class="w"></span>
<a id="__codelineno-11-22" name="__codelineno-11-22" href="#__codelineno-11-22"></a><span class="w">    </span><span class="n">Peer</span><span class="p">.</span><span class="na">Transaction</span><span class="w"> </span><span class="n">tran_2</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">superCreator</span><span class="p">.</span><span class="na">createInvokeTran</span><span class="p">(</span><span class="n">tranId_2</span><span class="p">,</span><span class="w"> </span><span class="n">superCertId</span><span class="p">,</span><span class="w"> </span><span class="n">didChaincodeId</span><span class="p">,</span><span class="w"> </span><span class="n">signUpOperate</span><span class="p">,</span><span class="w"> </span><span class="n">JsonFormat</span><span class="p">.</span><span class="na">printer</span><span class="p">().</span><span class="na">print</span><span class="p">(</span><span class="n">operate</span><span class="p">),</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;&quot;</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-11-23" name="__codelineno-11-23" href="#__codelineno-11-23"></a><span class="w">    </span><span class="n">postClient</span><span class="p">.</span><span class="na">postSignedTran</span><span class="p">(</span><span class="n">tran_2</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-11-24" name="__codelineno-11-24" href="#__codelineno-11-24"></a>
<a id="__codelineno-11-25" name="__codelineno-11-25" href="#__codelineno-11-25"></a><span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>3.部署管理合约，并注册对应的操作</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-12-1" name="__codelineno-12-1" href="#__codelineno-12-1"></a><span class="nd">@Test</span><span class="w"></span>
<a id="__codelineno-12-2" name="__codelineno-12-2" href="#__codelineno-12-2"></a><span class="nd">@DisplayName</span><span class="p">(</span><span class="s">&quot;SuperAdmin部署节点证书管理合约&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-12-3" name="__codelineno-12-3" href="#__codelineno-12-3"></a><span class="nd">@Order</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-12-4" name="__codelineno-12-4" href="#__codelineno-12-4"></a><span class="kt">void</span><span class="w"> </span><span class="nf">deployContractTest</span><span class="p">()</span><span class="w"> </span><span class="kd">throws</span><span class="w"> </span><span class="n">InterruptedException</span><span class="p">,</span><span class="w"> </span><span class="n">IOException</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<a id="__codelineno-12-5" name="__codelineno-12-5" href="#__codelineno-12-5"></a><span class="w">    </span><span class="n">String</span><span class="w"> </span><span class="n">tplString</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">FileUtils</span><span class="p">.</span><span class="na">readFileToString</span><span class="p">(</span><span class="k">new</span><span class="w"> </span><span class="n">File</span><span class="p">(</span><span class="s">&quot;jks/test/tpl/ManageNodeCert.scala&quot;</span><span class="p">),</span><span class="w"> </span><span class="n">StandardCharsets</span><span class="p">.</span><span class="na">UTF_8</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-12-6" name="__codelineno-12-6" href="#__codelineno-12-6"></a><span class="w">    </span><span class="n">Peer</span><span class="p">.</span><span class="na">ChaincodeDeploy</span><span class="w"> </span><span class="n">chaincodeDeploy</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Peer</span><span class="p">.</span><span class="na">ChaincodeDeploy</span><span class="p">.</span><span class="na">newBuilder</span><span class="p">()</span><span class="w"></span>
<a id="__codelineno-12-7" name="__codelineno-12-7" href="#__codelineno-12-7"></a><span class="w">            </span><span class="p">.</span><span class="na">setTimeout</span><span class="p">(</span><span class="mi">5000</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-12-8" name="__codelineno-12-8" href="#__codelineno-12-8"></a><span class="w">            </span><span class="p">.</span><span class="na">setCodePackage</span><span class="p">(</span><span class="n">tplString</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-12-9" name="__codelineno-12-9" href="#__codelineno-12-9"></a><span class="w">            </span><span class="p">.</span><span class="na">setLegalProse</span><span class="p">(</span><span class="s">&quot;&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-12-10" name="__codelineno-12-10" href="#__codelineno-12-10"></a><span class="w">            </span><span class="p">.</span><span class="na">setCType</span><span class="p">(</span><span class="n">Peer</span><span class="p">.</span><span class="na">ChaincodeDeploy</span><span class="p">.</span><span class="na">CodeType</span><span class="p">.</span><span class="na">CODE_SCALA</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-12-11" name="__codelineno-12-11" href="#__codelineno-12-11"></a><span class="w">            </span><span class="p">.</span><span class="na">setRType</span><span class="p">(</span><span class="n">Peer</span><span class="p">.</span><span class="na">ChaincodeDeploy</span><span class="p">.</span><span class="na">RunType</span><span class="p">.</span><span class="na">RUN_SERIAL</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-12-12" name="__codelineno-12-12" href="#__codelineno-12-12"></a><span class="w">            </span><span class="p">.</span><span class="na">setSType</span><span class="p">(</span><span class="n">Peer</span><span class="p">.</span><span class="na">ChaincodeDeploy</span><span class="p">.</span><span class="na">StateType</span><span class="p">.</span><span class="na">STATE_BLOCK</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-12-13" name="__codelineno-12-13" href="#__codelineno-12-13"></a><span class="w">            </span><span class="p">.</span><span class="na">setInitParameter</span><span class="p">(</span><span class="s">&quot;&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-12-14" name="__codelineno-12-14" href="#__codelineno-12-14"></a><span class="w">            </span><span class="p">.</span><span class="na">setCclassification</span><span class="p">(</span><span class="n">Peer</span><span class="p">.</span><span class="na">ChaincodeDeploy</span><span class="p">.</span><span class="na">ContractClassification</span><span class="p">.</span><span class="na">CONTRACT_CUSTOM</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-12-15" name="__codelineno-12-15" href="#__codelineno-12-15"></a><span class="w">            </span><span class="p">.</span><span class="na">build</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-12-16" name="__codelineno-12-16" href="#__codelineno-12-16"></a><span class="w">    </span><span class="n">DeployTran</span><span class="w"> </span><span class="n">deployTran</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">DeployTran</span><span class="p">.</span><span class="na">newBuilder</span><span class="p">()</span><span class="w"></span>
<a id="__codelineno-12-17" name="__codelineno-12-17" href="#__codelineno-12-17"></a><span class="w">            </span><span class="p">.</span><span class="na">setTxid</span><span class="p">(</span><span class="n">UUID</span><span class="p">.</span><span class="na">randomUUID</span><span class="p">().</span><span class="na">toString</span><span class="p">())</span><span class="w"></span>
<a id="__codelineno-12-18" name="__codelineno-12-18" href="#__codelineno-12-18"></a><span class="w">            </span><span class="p">.</span><span class="na">setCertId</span><span class="p">(</span><span class="n">superCertId</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-12-19" name="__codelineno-12-19" href="#__codelineno-12-19"></a><span class="w">            </span><span class="p">.</span><span class="na">setChaincodeId</span><span class="p">(</span><span class="n">manageNodeCertId</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-12-20" name="__codelineno-12-20" href="#__codelineno-12-20"></a><span class="w">            </span><span class="p">.</span><span class="na">setChaincodeDeploy</span><span class="p">(</span><span class="n">chaincodeDeploy</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-12-21" name="__codelineno-12-21" href="#__codelineno-12-21"></a><span class="w">            </span><span class="p">.</span><span class="na">build</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-12-22" name="__codelineno-12-22" href="#__codelineno-12-22"></a><span class="w">    </span><span class="n">deployTran</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">deployTran</span><span class="p">.</span><span class="na">toBuilder</span><span class="p">().</span><span class="na">setTxid</span><span class="p">(</span><span class="n">UUID</span><span class="p">.</span><span class="na">randomUUID</span><span class="p">().</span><span class="na">toString</span><span class="p">()).</span><span class="na">build</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-12-23" name="__codelineno-12-23" href="#__codelineno-12-23"></a><span class="w">    </span><span class="n">Peer</span><span class="p">.</span><span class="na">Transaction</span><span class="w"> </span><span class="n">signedDeployTran</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">credenceSuperCreator</span><span class="p">.</span><span class="na">createDeployTran</span><span class="p">(</span><span class="n">deployTran</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-12-24" name="__codelineno-12-24" href="#__codelineno-12-24"></a><span class="w">    </span><span class="n">postCredenceClient</span><span class="p">.</span><span class="na">postSignedTran</span><span class="p">(</span><span class="n">signedDeployTran</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-12-25" name="__codelineno-12-25" href="#__codelineno-12-25"></a><span class="w">    </span><span class="n">TimeUnit</span><span class="p">.</span><span class="na">SECONDS</span><span class="p">.</span><span class="na">sleep</span><span class="p">(</span><span class="mi">5</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-12-26" name="__codelineno-12-26" href="#__codelineno-12-26"></a><span class="w">    </span><span class="n">Peer</span><span class="p">.</span><span class="na">TransactionResult</span><span class="w"> </span><span class="n">tranResult</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">infoCredenceClient</span><span class="p">.</span><span class="na">getTranResultByTranId</span><span class="p">(</span><span class="n">signedDeployTran</span><span class="p">.</span><span class="na">getId</span><span class="p">());</span><span class="w"></span>
<a id="__codelineno-12-27" name="__codelineno-12-27" href="#__codelineno-12-27"></a><span class="w">    </span><span class="n">Peer</span><span class="p">.</span><span class="na">ActionResult</span><span class="w"> </span><span class="n">actionResult</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">tranResult</span><span class="p">.</span><span class="na">getErr</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-12-28" name="__codelineno-12-28" href="#__codelineno-12-28"></a><span class="w">    </span><span class="n">Assertions</span><span class="p">.</span><span class="na">assertEquals</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="n">actionResult</span><span class="p">.</span><span class="na">getCode</span><span class="p">(),</span><span class="w"> </span><span class="s">&quot;没有错误，部署合约成功&quot;</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-12-29" name="__codelineno-12-29" href="#__codelineno-12-29"></a>
<a id="__codelineno-12-30" name="__codelineno-12-30" href="#__codelineno-12-30"></a><span class="p">}</span><span class="w"></span>
<a id="__codelineno-12-31" name="__codelineno-12-31" href="#__codelineno-12-31"></a>
<a id="__codelineno-12-32" name="__codelineno-12-32" href="#__codelineno-12-32"></a><span class="nd">@Test</span><span class="w"></span>
<a id="__codelineno-12-33" name="__codelineno-12-33" href="#__codelineno-12-33"></a><span class="nd">@DisplayName</span><span class="p">(</span><span class="s">&quot;注册Operate-注册合约的某个方法---updateNodeCert&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-12-34" name="__codelineno-12-34" href="#__codelineno-12-34"></a><span class="nd">@Order</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-12-35" name="__codelineno-12-35" href="#__codelineno-12-35"></a><span class="kt">void</span><span class="w"> </span><span class="nf">testSignUpOperate</span><span class="p">()</span><span class="w"> </span><span class="kd">throws</span><span class="w"> </span><span class="n">InterruptedException</span><span class="p">,</span><span class="w"> </span><span class="n">InvalidProtocolBufferException</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<a id="__codelineno-12-36" name="__codelineno-12-36" href="#__codelineno-12-36"></a>
<a id="__codelineno-12-37" name="__codelineno-12-37" href="#__codelineno-12-37"></a><span class="w">    </span><span class="kt">long</span><span class="w"> </span><span class="n">millis</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">System</span><span class="p">.</span><span class="na">currentTimeMillis</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-12-38" name="__codelineno-12-38" href="#__codelineno-12-38"></a><span class="w">    </span><span class="n">Peer</span><span class="p">.</span><span class="na">Operate</span><span class="w"> </span><span class="n">operate</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Peer</span><span class="p">.</span><span class="na">Operate</span><span class="p">.</span><span class="na">newBuilder</span><span class="p">()</span><span class="w"></span>
<a id="__codelineno-12-39" name="__codelineno-12-39" href="#__codelineno-12-39"></a><span class="w">            </span><span class="p">.</span><span class="na">setOpId</span><span class="p">(</span><span class="n">DigestUtils</span><span class="p">.</span><span class="na">sha256Hex</span><span class="p">(</span><span class="s">&quot;credence-net:ManageNodeCert.updateNodeCert&quot;</span><span class="p">))</span><span class="w"></span>
<a id="__codelineno-12-40" name="__codelineno-12-40" href="#__codelineno-12-40"></a><span class="w">            </span><span class="p">.</span><span class="na">setDescription</span><span class="p">(</span><span class="s">&quot;管理节点证书&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-12-41" name="__codelineno-12-41" href="#__codelineno-12-41"></a><span class="w">            </span><span class="p">.</span><span class="na">setRegister</span><span class="p">(</span><span class="n">super_creditCode</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-12-42" name="__codelineno-12-42" href="#__codelineno-12-42"></a><span class="w">            </span><span class="p">.</span><span class="na">setIsPublish</span><span class="p">(</span><span class="kc">false</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-12-43" name="__codelineno-12-43" href="#__codelineno-12-43"></a><span class="w">            </span><span class="p">.</span><span class="na">setOperateType</span><span class="p">(</span><span class="n">Peer</span><span class="p">.</span><span class="na">Operate</span><span class="p">.</span><span class="na">OperateType</span><span class="p">.</span><span class="na">OPERATE_CONTRACT</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-12-44" name="__codelineno-12-44" href="#__codelineno-12-44"></a><span class="w">            </span><span class="p">.</span><span class="na">setAuthFullName</span><span class="p">(</span><span class="s">&quot;credence-net:ManageNodeCert.updateNodeCert&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-12-45" name="__codelineno-12-45" href="#__codelineno-12-45"></a><span class="w">            </span><span class="p">.</span><span class="na">setCreateTime</span><span class="p">(</span><span class="n">Timestamp</span><span class="p">.</span><span class="na">newBuilder</span><span class="p">().</span><span class="na">setSeconds</span><span class="p">(</span><span class="n">millis</span><span class="w"> </span><span class="o">/</span><span class="w"> </span><span class="mi">1000</span><span class="p">).</span><span class="na">setNanos</span><span class="p">((</span><span class="kt">int</span><span class="p">)</span><span class="w"> </span><span class="p">((</span><span class="n">millis</span><span class="w"> </span><span class="o">%</span><span class="w"> </span><span class="mi">1000</span><span class="p">)</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="mi">1000000</span><span class="p">)).</span><span class="na">build</span><span class="p">())</span><span class="w"></span>
<a id="__codelineno-12-46" name="__codelineno-12-46" href="#__codelineno-12-46"></a><span class="w">            </span><span class="p">.</span><span class="na">setOpValid</span><span class="p">(</span><span class="kc">true</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-12-47" name="__codelineno-12-47" href="#__codelineno-12-47"></a><span class="w">            </span><span class="p">.</span><span class="na">setVersion</span><span class="p">(</span><span class="s">&quot;1.0&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-12-48" name="__codelineno-12-48" href="#__codelineno-12-48"></a><span class="w">            </span><span class="p">.</span><span class="na">build</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-12-49" name="__codelineno-12-49" href="#__codelineno-12-49"></a><span class="w">    </span><span class="n">String</span><span class="w"> </span><span class="n">tranId</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">UUID</span><span class="p">.</span><span class="na">randomUUID</span><span class="p">().</span><span class="na">toString</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-12-50" name="__codelineno-12-50" href="#__codelineno-12-50"></a><span class="w">    </span><span class="n">Peer</span><span class="p">.</span><span class="na">Transaction</span><span class="w"> </span><span class="n">tran</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">superCreator</span><span class="p">.</span><span class="na">createInvokeTran</span><span class="p">(</span><span class="n">tranId</span><span class="p">,</span><span class="w"> </span><span class="n">superCertId</span><span class="p">,</span><span class="w"> </span><span class="n">didChaincodeId</span><span class="p">,</span><span class="w"> </span><span class="n">signUpOperate</span><span class="p">,</span><span class="w"> </span><span class="n">JsonFormat</span><span class="p">.</span><span class="na">printer</span><span class="p">().</span><span class="na">print</span><span class="p">(</span><span class="n">operate</span><span class="p">),</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;&quot;</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-12-51" name="__codelineno-12-51" href="#__codelineno-12-51"></a><span class="w">    </span><span class="n">postClient</span><span class="p">.</span><span class="na">postSignedTran</span><span class="p">(</span><span class="n">tran</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-12-52" name="__codelineno-12-52" href="#__codelineno-12-52"></a><span class="w">    </span><span class="n">TimeUnit</span><span class="p">.</span><span class="na">SECONDS</span><span class="p">.</span><span class="na">sleep</span><span class="p">(</span><span class="mi">5</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-12-53" name="__codelineno-12-53" href="#__codelineno-12-53"></a><span class="w">    </span><span class="n">Peer</span><span class="p">.</span><span class="na">TransactionResult</span><span class="w"> </span><span class="n">tranResult</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">infoClient</span><span class="p">.</span><span class="na">getTranResultByTranId</span><span class="p">(</span><span class="n">tranId</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-12-54" name="__codelineno-12-54" href="#__codelineno-12-54"></a><span class="w">    </span><span class="n">Peer</span><span class="p">.</span><span class="na">ActionResult</span><span class="w"> </span><span class="n">actionResult</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">tranResult</span><span class="p">.</span><span class="na">getErr</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-12-55" name="__codelineno-12-55" href="#__codelineno-12-55"></a><span class="w">    </span><span class="n">Assertions</span><span class="p">.</span><span class="na">assertEquals</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="n">actionResult</span><span class="p">.</span><span class="na">getCode</span><span class="p">(),</span><span class="w"> </span><span class="s">&quot;没有错误，操作注册成功&quot;</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-12-56" name="__codelineno-12-56" href="#__codelineno-12-56"></a><span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>4.调用合约中的方法来添加或者删除响应节点的证书，具体的使用细节，交易构造，合约方法以及合约参数如下：</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-13-1" name="__codelineno-13-1" href="#__codelineno-13-1"></a><span class="nd">@Test</span><span class="w"></span>
<a id="__codelineno-13-2" name="__codelineno-13-2" href="#__codelineno-13-2"></a><span class="nd">@DisplayName</span><span class="p">(</span><span class="s">&quot;提交交易，增加证书&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-13-3" name="__codelineno-13-3" href="#__codelineno-13-3"></a><span class="nd">@Order</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-13-4" name="__codelineno-13-4" href="#__codelineno-13-4"></a><span class="kt">void</span><span class="w"> </span><span class="nf">testAddCert</span><span class="p">()</span><span class="w"> </span><span class="kd">throws</span><span class="w"> </span><span class="n">IOException</span><span class="p">,</span><span class="w"> </span><span class="n">InterruptedException</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<a id="__codelineno-13-5" name="__codelineno-13-5" href="#__codelineno-13-5"></a><span class="w">    </span><span class="n">String</span><span class="w"> </span><span class="n">tranId</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">UUID</span><span class="p">.</span><span class="na">randomUUID</span><span class="p">().</span><span class="na">toString</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-13-6" name="__codelineno-13-6" href="#__codelineno-13-6"></a><span class="w">    </span><span class="n">HashMap</span><span class="o">&lt;</span><span class="n">String</span><span class="p">,</span><span class="w"> </span><span class="n">String</span><span class="o">&gt;</span><span class="w"> </span><span class="n">certMap</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">new</span><span class="w"> </span><span class="n">HashMap</span><span class="o">&lt;&gt;</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-13-7" name="__codelineno-13-7" href="#__codelineno-13-7"></a><span class="w">    </span><span class="c1">// 读取pem字符串</span><span class="w"></span>
<a id="__codelineno-13-8" name="__codelineno-13-8" href="#__codelineno-13-8"></a><span class="w">    </span><span class="n">certMap</span><span class="p">.</span><span class="na">put</span><span class="p">(</span><span class="s">&quot;node11Name&quot;</span><span class="p">,</span><span class="w"> </span><span class="n">FileUtils</span><span class="p">.</span><span class="na">readFileToString</span><span class="p">(</span><span class="k">new</span><span class="w"> </span><span class="n">File</span><span class="p">(</span><span class="s">&quot;jks/test/multi_chain/&quot;</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="n">node11Name</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="s">&quot;.cer&quot;</span><span class="p">),</span><span class="w"> </span><span class="n">StandardCharsets</span><span class="p">.</span><span class="na">UTF_8</span><span class="p">));</span><span class="w"></span>
<a id="__codelineno-13-9" name="__codelineno-13-9" href="#__codelineno-13-9"></a><span class="w">    </span><span class="n">Peer</span><span class="p">.</span><span class="na">Transaction</span><span class="w"> </span><span class="n">tran</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">credenceSuperCreator</span><span class="p">.</span><span class="na">createInvokeTran</span><span class="p">(</span><span class="n">tranId</span><span class="p">,</span><span class="w"> </span><span class="n">superCertId</span><span class="p">,</span><span class="w"> </span><span class="n">manageNodeCertId</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;updateNodeCert&quot;</span><span class="p">,</span><span class="w"> </span><span class="n">JSON</span><span class="p">.</span><span class="na">toJSONString</span><span class="p">(</span><span class="n">certMap</span><span class="p">),</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;&quot;</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-13-10" name="__codelineno-13-10" href="#__codelineno-13-10"></a><span class="w">    </span><span class="n">postCredenceClient</span><span class="p">.</span><span class="na">postSignedTran</span><span class="p">(</span><span class="n">tran</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-13-11" name="__codelineno-13-11" href="#__codelineno-13-11"></a><span class="p">}</span><span class="w"></span>
<a id="__codelineno-13-12" name="__codelineno-13-12" href="#__codelineno-13-12"></a>
<a id="__codelineno-13-13" name="__codelineno-13-13" href="#__codelineno-13-13"></a>
<a id="__codelineno-13-14" name="__codelineno-13-14" href="#__codelineno-13-14"></a><span class="nd">@Test</span><span class="w"></span>
<a id="__codelineno-13-15" name="__codelineno-13-15" href="#__codelineno-13-15"></a><span class="nd">@DisplayName</span><span class="p">(</span><span class="s">&quot;提交交易，删除证书&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-13-16" name="__codelineno-13-16" href="#__codelineno-13-16"></a><span class="nd">@Order</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-13-17" name="__codelineno-13-17" href="#__codelineno-13-17"></a><span class="kt">void</span><span class="w"> </span><span class="nf">testDeleteCert</span><span class="p">()</span><span class="w"> </span><span class="kd">throws</span><span class="w"> </span><span class="n">IOException</span><span class="p">,</span><span class="w"> </span><span class="n">InterruptedException</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<a id="__codelineno-13-18" name="__codelineno-13-18" href="#__codelineno-13-18"></a><span class="w">    </span><span class="n">String</span><span class="w"> </span><span class="n">tranId</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">UUID</span><span class="p">.</span><span class="na">randomUUID</span><span class="p">().</span><span class="na">toString</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-13-19" name="__codelineno-13-19" href="#__codelineno-13-19"></a><span class="w">    </span><span class="n">HashMap</span><span class="o">&lt;</span><span class="n">String</span><span class="p">,</span><span class="w"> </span><span class="n">String</span><span class="o">&gt;</span><span class="w"> </span><span class="n">certMap</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">new</span><span class="w"> </span><span class="n">HashMap</span><span class="o">&lt;&gt;</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-13-20" name="__codelineno-13-20" href="#__codelineno-13-20"></a><span class="w">     </span><span class="c1">// 置空即可</span><span class="w"></span>
<a id="__codelineno-13-21" name="__codelineno-13-21" href="#__codelineno-13-21"></a><span class="w">    </span><span class="n">certMap</span><span class="p">.</span><span class="na">put</span><span class="p">(</span><span class="s">&quot;node11Name&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;&quot;</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-13-22" name="__codelineno-13-22" href="#__codelineno-13-22"></a><span class="w">    </span><span class="n">Peer</span><span class="p">.</span><span class="na">Transaction</span><span class="w"> </span><span class="n">tran</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">credenceSuperCreator</span><span class="p">.</span><span class="na">createInvokeTran</span><span class="p">(</span><span class="n">tranId</span><span class="p">,</span><span class="w"> </span><span class="n">superCertId</span><span class="p">,</span><span class="w"> </span><span class="n">manageNodeCertId</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;updateNodeCert&quot;</span><span class="p">,</span><span class="w"> </span><span class="n">JSON</span><span class="p">.</span><span class="na">toJSONString</span><span class="p">(</span><span class="n">certMap</span><span class="p">),</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;&quot;</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-13-23" name="__codelineno-13-23" href="#__codelineno-13-23"></a><span class="w">    </span><span class="n">postCredenceClient</span><span class="p">.</span><span class="na">postSignedTran</span><span class="p">(</span><span class="n">tran</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-13-24" name="__codelineno-13-24" href="#__codelineno-13-24"></a><span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>除了上面说的要提交交易调用合约之外，还可以配合管理服务（RepChainManagement）来启停节点</p>
<p>1.调用合约删除节点证书后，通过对应的RepChainManagement来ShutDown对应的节点</p>
<blockquote>
<p>如果该节点是通过RepChainManagement启动的，则通过RepChainManagement来ShutDown；如果是作为单独的进程启动的，则手动shutdown即可</p>
</blockquote>
<p>2.调用合约新增节点证书后，通过对应的RepChainManagement来StartUp对应的节点</p>
<blockquote>
<p>该节点可以通过RepChainManagement启动，也可手动来StartUp</p>
</blockquote>
<h3 id="_30">验证方式</h3>
<p>可以按如下方式来验证新增节点是否成功</p>
<ul>
<li>
<p>通过接口查询节点数</p>
<p>1.向网络中原有的节点API查询网络节点总数是否增加，同时向新增的节点API查询返回结果是否和网络原有节点一致</p>
<blockquote>
<p>查询节点数：<a href="http://ip:port/chaininfo/node">http://ip:port/chaininfo/node</a></p>
</blockquote>
</li>
<li>
<p>同时可查询新增节点的chaininfo是否有变化</p>
<p>1.正常是会同步区块的，因此其chaininfo中显示的高度逐渐变高，并最终和其他节点一致</p>
<blockquote>
<p>查询链信息：<a href="http://ip:port/chaininfo">http://ip:port/chaininfo</a></p>
</blockquote>
</li>
<li>
<p>可以通过查看对应节点的实时图</p>
<p>1.如果新增节点可以正常显示与网络内其他节点一致的实时图，那么是没问题的</p>
<blockquote>
<p>前端实时图：<a href="http://ip:port/web/g1.html">http://ip:port/web/g1.html</a></p>
</blockquote>
</li>
</ul>
<h2 id="_31">动态管理共识列表</h2>
<h3 id="_32">管理方案</h3>
<ul>
<li>
<p><strong>RepChain2.0.0之前的版本</strong>，基于配置里的抽签列表进行抽签选择出块人，如果想要修改抽签列表（共识节点列表），需要修改所有节点的配置，并重启整个集群网络</p>
</li>
<li>
<p><strong>RepChain2.0.0及之后</strong>，实现了通过合约管理RepChain的共识抽签列表，无需再修改配置并重启整个网络了，即可以在线动态修改抽签列表</p>
<p>测试用例：<a href="https://gitee.com/BTAJL/RCJava-core/blob/master/src/test/java/com/rcjava/multi_chain/ManageNodeCertTest.java#L230">https://gitee.com/BTAJL/RCJava-core/blob/master/src/test/java/com/rcjava/multi_chain/ManageNodeCertTest.java#L230</a></p>
</li>
</ul>
<h3 id="_33">使用流程</h3>
<blockquote>
<p>在上一章节(ManageNodeCert的合约已经部署)的基础上</p>
</blockquote>
<p>1.首先superAdmin为自己注册updateVoteList操作</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-14-1" name="__codelineno-14-1" href="#__codelineno-14-1"></a><span class="nd">@Test</span><span class="w"></span>
<a id="__codelineno-14-2" name="__codelineno-14-2" href="#__codelineno-14-2"></a><span class="nd">@DisplayName</span><span class="p">(</span><span class="s">&quot;注册Operate-注册合约的某个方法---updateVoteList&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-14-3" name="__codelineno-14-3" href="#__codelineno-14-3"></a><span class="nd">@Order</span><span class="p">(</span><span class="mi">6</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-14-4" name="__codelineno-14-4" href="#__codelineno-14-4"></a><span class="kt">void</span><span class="w"> </span><span class="nf">testSignUpOperate_1</span><span class="p">()</span><span class="w"> </span><span class="kd">throws</span><span class="w"> </span><span class="n">InterruptedException</span><span class="p">,</span><span class="w"> </span><span class="n">InvalidProtocolBufferException</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<a id="__codelineno-14-5" name="__codelineno-14-5" href="#__codelineno-14-5"></a><span class="w">    </span><span class="kt">long</span><span class="w"> </span><span class="n">millis</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">System</span><span class="p">.</span><span class="na">currentTimeMillis</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-14-6" name="__codelineno-14-6" href="#__codelineno-14-6"></a><span class="w">    </span><span class="n">Peer</span><span class="p">.</span><span class="na">Operate</span><span class="w"> </span><span class="n">operate</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Peer</span><span class="p">.</span><span class="na">Operate</span><span class="p">.</span><span class="na">newBuilder</span><span class="p">()</span><span class="w"></span>
<a id="__codelineno-14-7" name="__codelineno-14-7" href="#__codelineno-14-7"></a><span class="w">            </span><span class="p">.</span><span class="na">setOpId</span><span class="p">(</span><span class="n">DigestUtils</span><span class="p">.</span><span class="na">sha256Hex</span><span class="p">(</span><span class="s">&quot;credence-net:ManageNodeCert.updateVoteList&quot;</span><span class="p">))</span><span class="w"></span>
<a id="__codelineno-14-8" name="__codelineno-14-8" href="#__codelineno-14-8"></a><span class="w">            </span><span class="p">.</span><span class="na">setDescription</span><span class="p">(</span><span class="s">&quot;管理抽签列表&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-14-9" name="__codelineno-14-9" href="#__codelineno-14-9"></a><span class="w">            </span><span class="p">.</span><span class="na">setRegister</span><span class="p">(</span><span class="n">super_creditCode</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-14-10" name="__codelineno-14-10" href="#__codelineno-14-10"></a><span class="w">            </span><span class="p">.</span><span class="na">setIsPublish</span><span class="p">(</span><span class="kc">false</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-14-11" name="__codelineno-14-11" href="#__codelineno-14-11"></a><span class="w">            </span><span class="p">.</span><span class="na">setOperateType</span><span class="p">(</span><span class="n">Peer</span><span class="p">.</span><span class="na">Operate</span><span class="p">.</span><span class="na">OperateType</span><span class="p">.</span><span class="na">OPERATE_CONTRACT</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-14-12" name="__codelineno-14-12" href="#__codelineno-14-12"></a><span class="w">            </span><span class="p">.</span><span class="na">setAuthFullName</span><span class="p">(</span><span class="s">&quot;credence-net:ManageNodeCert.updateVoteList&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-14-13" name="__codelineno-14-13" href="#__codelineno-14-13"></a><span class="w">            </span><span class="p">.</span><span class="na">setCreateTime</span><span class="p">(</span><span class="n">Timestamp</span><span class="p">.</span><span class="na">newBuilder</span><span class="p">().</span><span class="na">setSeconds</span><span class="p">(</span><span class="n">millis</span><span class="w"> </span><span class="o">/</span><span class="w"> </span><span class="mi">1000</span><span class="p">).</span><span class="na">setNanos</span><span class="p">((</span><span class="kt">int</span><span class="p">)</span><span class="w"> </span><span class="p">((</span><span class="n">millis</span><span class="w"> </span><span class="o">%</span><span class="w"> </span><span class="mi">1000</span><span class="p">)</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="mi">1000000</span><span class="p">)).</span><span class="na">build</span><span class="p">())</span><span class="w"></span>
<a id="__codelineno-14-14" name="__codelineno-14-14" href="#__codelineno-14-14"></a><span class="w">            </span><span class="p">.</span><span class="na">setOpValid</span><span class="p">(</span><span class="kc">true</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-14-15" name="__codelineno-14-15" href="#__codelineno-14-15"></a><span class="w">            </span><span class="p">.</span><span class="na">setVersion</span><span class="p">(</span><span class="s">&quot;1.0&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-14-16" name="__codelineno-14-16" href="#__codelineno-14-16"></a><span class="w">            </span><span class="p">.</span><span class="na">build</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-14-17" name="__codelineno-14-17" href="#__codelineno-14-17"></a><span class="w">    </span><span class="n">String</span><span class="w"> </span><span class="n">tranId</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">UUID</span><span class="p">.</span><span class="na">randomUUID</span><span class="p">().</span><span class="na">toString</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-14-18" name="__codelineno-14-18" href="#__codelineno-14-18"></a><span class="w">    </span><span class="n">Peer</span><span class="p">.</span><span class="na">Transaction</span><span class="w"> </span><span class="n">tran</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">superCreator</span><span class="p">.</span><span class="na">createInvokeTran</span><span class="p">(</span><span class="n">tranId</span><span class="p">,</span><span class="w"> </span><span class="n">superCertId</span><span class="p">,</span><span class="w"> </span><span class="n">didChaincodeId</span><span class="p">,</span><span class="w"> </span><span class="n">signUpOperate</span><span class="p">,</span><span class="w"> </span><span class="n">JsonFormat</span><span class="p">.</span><span class="na">printer</span><span class="p">().</span><span class="na">print</span><span class="p">(</span><span class="n">operate</span><span class="p">),</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;&quot;</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-14-19" name="__codelineno-14-19" href="#__codelineno-14-19"></a><span class="w">    </span><span class="n">postClient</span><span class="p">.</span><span class="na">postSignedTran</span><span class="p">(</span><span class="n">tran</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-14-20" name="__codelineno-14-20" href="#__codelineno-14-20"></a><span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>2.superAdmin调用该方法("updateVoteList")来修改共识列表</p>
<blockquote>
<p>交易参数为参与共识的节点名列表</p>
</blockquote>
<div class="highlight"><pre><span></span><code><a id="__codelineno-15-1" name="__codelineno-15-1" href="#__codelineno-15-1"></a><span class="nd">@Test</span><span class="w"></span>
<a id="__codelineno-15-2" name="__codelineno-15-2" href="#__codelineno-15-2"></a><span class="nd">@DisplayName</span><span class="p">(</span><span class="s">&quot;提交交易，更新抽签列表&quot;</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-15-3" name="__codelineno-15-3" href="#__codelineno-15-3"></a><span class="nd">@Order</span><span class="p">(</span><span class="mi">7</span><span class="p">)</span><span class="w"></span>
<a id="__codelineno-15-4" name="__codelineno-15-4" href="#__codelineno-15-4"></a><span class="kt">void</span><span class="w"> </span><span class="nf">testUpdateVoteList</span><span class="p">()</span><span class="w"> </span><span class="kd">throws</span><span class="w"> </span><span class="n">InterruptedException</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<a id="__codelineno-15-5" name="__codelineno-15-5" href="#__codelineno-15-5"></a><span class="w">    </span><span class="n">String</span><span class="w"> </span><span class="n">tranId</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">UUID</span><span class="p">.</span><span class="na">randomUUID</span><span class="p">().</span><span class="na">toString</span><span class="p">();</span><span class="w"></span>
<a id="__codelineno-15-6" name="__codelineno-15-6" href="#__codelineno-15-6"></a><span class="w">    </span><span class="c1">// 最新的共识列表</span><span class="w"></span>
<a id="__codelineno-15-7" name="__codelineno-15-7" href="#__codelineno-15-7"></a><span class="w">    </span><span class="n">List</span><span class="o">&lt;</span><span class="n">String</span><span class="o">&gt;</span><span class="w"> </span><span class="n">voteList</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Arrays</span><span class="p">.</span><span class="na">asList</span><span class="p">(</span><span class="s">&quot;330597659476689954.node6&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;044934755127708189.node7&quot;</span><span class="p">,</span><span class="w"></span>
<a id="__codelineno-15-8" name="__codelineno-15-8" href="#__codelineno-15-8"></a><span class="c1">//                &quot;201353514191149590.node8&quot;,</span><span class="w"></span>
<a id="__codelineno-15-9" name="__codelineno-15-9" href="#__codelineno-15-9"></a><span class="w">            </span><span class="s">&quot;734747416095474396.node9&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;710341838996249513.node10&quot;</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-15-10" name="__codelineno-15-10" href="#__codelineno-15-10"></a><span class="w">    </span><span class="n">Peer</span><span class="p">.</span><span class="na">Transaction</span><span class="w"> </span><span class="n">tran</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">credenceSuperCreator</span><span class="p">.</span><span class="na">createInvokeTran</span><span class="p">(</span><span class="n">tranId</span><span class="p">,</span><span class="w"> </span><span class="n">superCertId</span><span class="p">,</span><span class="w"> </span><span class="n">manageNodeCertId</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;updateVoteList&quot;</span><span class="p">,</span><span class="w"> </span><span class="n">JSON</span><span class="p">.</span><span class="na">toJSONString</span><span class="p">(</span><span class="n">voteList</span><span class="p">),</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;&quot;</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-15-11" name="__codelineno-15-11" href="#__codelineno-15-11"></a><span class="w">    </span><span class="n">postCredenceClient</span><span class="p">.</span><span class="na">postSignedTran</span><span class="p">(</span><span class="n">tran</span><span class="p">);</span><span class="w"></span>
<a id="__codelineno-15-12" name="__codelineno-15-12" href="#__codelineno-15-12"></a><span class="p">}</span><span class="w"></span>
</code></pre></div>
<h3 id="_34">验证方式</h3>
<ul>
<li>
<p>通过接口查询节点数</p>
<p>1.向网络中的节点API查询网络共识节点数是否发生变化</p>
<blockquote>
<p>查询节点数：<a href="http://ip:port/chaininfo/node">http://ip:port/chaininfo/node</a></p>
</blockquote>
</li>
<li>
<p>提交修改共识列表的交易并入块之后，可以在前端实时图上看到改变，下面以例子进行说明：</p>
<p>1.假设原来具有5个共识节点，分别为<u>"330597659476689954.node6", "044934755127708189.node7", "201353514191149590.node8", "734747416095474396.node9", "710341838996249513.node10"</u>，可以从实时图看到下图(主要关注圈上的节点数，其他数据为模拟的非重点数据)：</p>
<p><img alt="update-vote-list-5" src="../img/update-vote-list-5.png" /></p>
<p>2.提交修改共识列表的交易，将node8踢出共识列表，实时图变为如下(主要关注圈上的节点数，其他数据为模拟的非重点数据)：</p>
<p><img alt="update-vote-list-4" src="../img/update-vote-list-4.png" /></p>
<p>3.通过实时图上节点的变化，可以看出共识节点数少了节点8，共识列表修改成功</p>
</li>
</ul>
<h2 id="qa">Q&amp;A</h2>
<ul>
<li>判断交易是否上链</li>
</ul>
<blockquote>
<p>查询交易在区块中的执行结果，即TransactionResult</p>
</blockquote>

              
            </article>
          </div>
        </div>
        
          <a href="#" class="md-top md-icon" data-md-component="top" data-md-state="hidden">
            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8v12Z"/></svg>
            回到页面顶部
          </a>
        
      </main>
      
        <footer class="md-footer">
  
    <nav class="md-footer__inner md-grid" aria-label="页脚">
      
        
        <a href=".." class="md-footer__link md-footer__link--prev" aria-label="上一页: 首页" rel="prev">
          <div class="md-footer__button md-icon">
            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12Z"/></svg>
          </div>
          <div class="md-footer__title">
            <div class="md-ellipsis">
              <span class="md-footer__direction">
                上一页
              </span>
              首页
            </div>
          </div>
        </a>
      
      
        
        <a href="../deploy/" class="md-footer__link md-footer__link--next" aria-label="下一页: 安装部署" rel="next">
          <div class="md-footer__title">
            <div class="md-ellipsis">
              <span class="md-footer__direction">
                下一页
              </span>
              安装部署
            </div>
          </div>
          <div class="md-footer__button md-icon">
            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 11v2h12l-5.5 5.5 1.42 1.42L19.84 12l-7.92-7.92L10.5 5.5 16 11H4Z"/></svg>
          </div>
        </a>
      
    </nav>
  
  <div class="md-footer-meta md-typeset">
    <div class="md-footer-meta__inner md-grid">
      <div class="md-copyright">
  
    <div class="md-copyright__highlight">
      Copyright &copy; 2021-2022 RepChain V2.0
    </div>
  
  
    Made with
    <a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
      Material for MkDocs
    </a>
  
</div>
      
    </div>
  </div>
</footer>
      
    </div>
    <div class="md-dialog" data-md-component="dialog">
      <div class="md-dialog__inner md-typeset"></div>
    </div>
    <script id="__config" type="application/json">{"base": "..", "features": ["content.code.annotate", "search.highlight", "navigation.top"], "search": "../assets/javascripts/workers/search.2a1c317c.min.js", "translations": {"clipboard.copied": "\u5df2\u590d\u5236", "clipboard.copy": "\u590d\u5236", "search.config.lang": "ja", "search.config.pipeline": "trimmer, stemmer", "search.config.separator": "[\\uff0c\\u3002]+", "search.placeholder": "\u641c\u7d22", "search.result.more.one": "\u5728\u8be5\u9875\u4e0a\u8fd8\u6709 1 \u4e2a\u7b26\u5408\u6761\u4ef6\u7684\u7ed3\u679c", "search.result.more.other": "\u5728\u8be5\u9875\u4e0a\u8fd8\u6709 # \u4e2a\u7b26\u5408\u6761\u4ef6\u7684\u7ed3\u679c", "search.result.none": "\u6ca1\u6709\u627e\u5230\u7b26\u5408\u6761\u4ef6\u7684\u7ed3\u679c", "search.result.one": "\u627e\u5230 1 \u4e2a\u7b26\u5408\u6761\u4ef6\u7684\u7ed3\u679c", "search.result.other": "# \u4e2a\u7b26\u5408\u6761\u4ef6\u7684\u7ed3\u679c", "search.result.placeholder": "\u952e\u5165\u4ee5\u5f00\u59cb\u641c\u7d22", "search.result.term.missing": "\u7f3a\u5c11", "select.version.title": "\u9009\u62e9\u5f53\u524d\u7248\u672c"}}</script>
    
    
      <script src="../assets/javascripts/bundle.748e2769.min.js"></script>
      
    
  </body>
</html>